I forget one last case that I discovered recently... if a class returned by the 
backend is not used explicitly, in a variable, no binding is performed and if 
you interrogate the variable it returns null.

Let me give you an example...
I have an ICTypeArqBaseMethod interface that implements some return classes 
from my backend: CTypeXXXBaseMethod. The Controller that receives the data from 
the back manages them through the interface, ICTypeArqBaseMethod, instead of 
working with typed variables, CTypeXXXBaseMethod.

To solve this, you have to explicitly register the class with 
org.apache.royale.reflection.registerClassAlias("com.example.CTypeXXXBaseMethod",
 "CTypeXXXBaseMethod") in the initialize event of Application OR create a 
variable, somewhere, of type " CTypeXXXXBaseMethod".

Hiedra.

-----Mensaje original-----
De: Maria Jose Esteve <mjest...@iest.com> 
Enviado el: martes, 27 de abril de 2021 23:16
Para: dev@royale.apache.org
Asunto: RE: Casting workarounds

Hi, I don't know if I'm understanding correctly?
I have encountered this situation a lot of times in my project and 99.8% of the 
times it was because the structures were "not exactly the same", usually 
because of upper/lower case or because I forgot to put 
"[RemoteClass(alias="com.example.MyClass")]". Then I have 0.2% of casps that I 
can't get them to map, in these cases I simply do what Harbs said: create an 
object and manually map the properties.

Could you post the structure of your backend and the structure you have defined 
in as, maybe we can see something.

Hiedra.

-----Mensaje original-----
De: GAbe Barbosa <gbarbosa...@gmail.com> Enviado el: martes, 27 de abril de 
2021 22:02
Para: dev@royale.apache.org
Asunto: Re: Casting workarounds

For clarity this is a cast that worked in Flex/Flash from the response of an 
AMF call. Upon investigation it looks like AMF is stripping away property class 
data on it's return from the server.

This is the structure. We return ResultVO from java with a property result of 
ChildVO.

In our Royale App we successfully cast var r:ResultVO = response as ResultVO;

but r.result is being seen as a Function() instead of ChildVO. So no matter if 
I cast with as operator or explicitly both fail.

Reply via email to