Expand my Community achievements bar.

final properties isn't serilised from java to flex

Avatar

Former Community Member
At Java side I have this class:



public final class TitleName {

@NotNull

public final Integer id;

@NotNull

public final String name;

...

}



that at Flex side I try to use as Dynamic Object. But calling Java service and obtainin this object as call result at Flex side I've got empty Object without any property. When I remove final declaration from Java fields all works correctly and at Flex I have Objects with id and name.



Is this a bug?
1 Reply

Avatar

Level 3
Hi Den,



That's not a bug - it's a result of the AMF serialization rules.



http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/wwhelp.htm...



For a class to support AMF serialization it must follow Java bean syntax (no-arg constructor, public get/set properties or public readable/writeable variables, etc.). The 'final' keyword makes the variable unwriteable - and thus, unserializable.



HTH,

Seth