flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Dove <greg.d...@gmail.com>
Subject Re: FlexJS : AMFJS Class Mapping
Date Sat, 12 Nov 2016 22:03:08 GMT
Hi Prashant,

The methods added to the reflection package were to support storing aliases
(for class mappings) and also retrieving the class based on the stored
alias.

In the patient case the local alias would also be "org.blazeds.vo.Patient"

I am not familiar with the approach you are using for deserializing the amf
in js, but I expect the general approach should be something like this:

a) identify the alias from the inbound amf data (seems like the
_explicitType field in your data)
b) retrieve the local class that corresponds to that alias and instantiate
an instance using getClassByAlias method from the _explicitType value:  var
classToInstantiate:Class = getClassByAlias("org.blazeds.vo.Patient");
This class should have been already registered using registerClassAlias at
some earlier point in time.
c) populate the fields of that typed instance based on the value of the
fields during deserialization. Ideally this should happen during
deserialization directly into the new typed instance instead of creating
one generic object during deserialization and then using it to subsequently
populate the typed instance.

If you are using a 3rd party library then unless it has support for the
explicitType mappings (to retrieve from getClassByAlias) perhaps you will
need to work from the object structure with the _explictType fields and
recreate the typed object structure from it (again, it would be helpful if
the library had some sort of mapping to avoid this 'double handling'). This
could be more complicated if the inbound amf has instances with nested
custom class fields, but should be straightforward for basic value object
type scenarios (as per your Patient example).


Hopefully that makes sense.... let me know if I can clarify any of the
above.


cheers,
Greg



On Sun, Nov 13, 2016 at 5:27 AM, PKumar <prashakumar@gmail.com> wrote:

> Hi,
>
> I am working on amfjs integration and it almost done. but i need to map the
> java clas object to AS3 class object. I am getting the _explicitType from
> BlazeDS side but could not map it with AS3 object. i also used the
> registerClassAlias but nothing working. I attached the trace from chorme.
> Please suggest how can i do it in FlexJS.
>
> <http://apache-flex-users.2333346.n4.nabble.com/file/n14106/capture.png>
>
>
>
> -----
> Regards,
> Prashant
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/FlexJS-AMFJS-Class-Mapping-tp14106.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message