>
> Regarding,
> registerClassAlias(unTypeObject['_explicitType'],
> getClassByAlias(unTypeObject['_explicitType']))
>
> - I am getting the data from blazeDs and blazeDS adding the "_explicitType"
> to every object.
>

Great - I assume _explicitType is the alias used to retrieve the class
clientside, this seems clear to me.


> - I am just picking "_explicitType" and registering that class using
> registerClassAlias()
>

Using registerClassAlias here is what seems unusual to me.

registerClassAlias normally occurs early in an application startup or at
some point before any amf data has been received from any remote server.
registerClassAlias needs to be done *before* getClassByAlias will work, so
it does not seem correct to use getClassByAlias inside a registerClassAlias
call (it should return null if the alias is not already registered).




> - Same _explicitType class, i am having inside my project in same package
> structure.
> - One point to note here is that i added registerClassAlias inside my AMF
> library not in main application. means library project not having the
> "_explicitType" class.
>


I hope I have understood what you are doing correctly.
I would not expect registerClassAlias to be used inside the amf library - I
don't think that is close to the original functionality in flash player for
amf deserialization.
I would expect an amf library to perhaps use getClassByAlias, but not
registerClassAlias. In a traditional Flex 4 project, registerClassAlias
should happen before any amf remoting activity as well. In Flex 4 (and
earlier Flex) registerClassAlias was often implemented by metadata on the
class and early reference to the class in terms of dependencies, which I
suspect ran the registerClassAlias code in a static initializer, before any
amf deserialization takes place.

Maybe there are some javascript tricks for converting/casting an untyped
object to a typed object without instantiating anything new that I don't
know about because I am unfamiliar, but if not then I expect the most
efficient implementation would include an attempt to getClassByAlias from
the explictType data at a lower level inside the amf library code, before
the 'unTypeObject' js object is created from the amf data. If
getClassByAlias returns a class (and not null) then it would be preferable
to instantiate that class and populate the instance fields directly instead
of creating a generic js object and adding _explicitType field (which is
then later replaced with the typed object after inspecting _explicitType
value and attempting getClassByAlias).
However, this deeper level of integration is probably easier to do in a
future custom FlexJS implementation for amf, unless the library you are
using has a configurable runtime override of what it in instantiates for
the alias information it receives, instead of simply creating a new generic
object every time.

If I have made this sound too complicated, sorry I was trying not to.
Please ask me to clarify any of my points if this does not seem clear.
Perhaps I have the wrong interpretation of what you are doing and none of
this is relevant.
I hope to get back to some work on FlexJS soon and perhaps I can look at a
custom amf implementation in the js side as part of the framework if no-one
else has gotten to it yet.


>
>
>
>
>
> -----
> Regards,
> Prashant
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/FlexJS-Reflection-API-tp14701p14711.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply via email to