|
Usage2x
FlexXB 2.x usage
FlexXB 2.x allows extensions to support different serialization formats. Due to the architectural changes to support this feature, the main access point from the 1.x version, com.googlecode.serializer.flexxb.FlexXBEngine is deprecated in FlexXB 2.x. However, for compatibility reasons this class is still available; it will only work for xml serialization and provide the same methods as in previous versions. Do not use FlexXBEngine class if you need to support a new serialization format. To get an idea about the features FlexXB provides please take a look on the Features in detailed explanation page. You'll find detailed explanations for all capabilities FlexXB offers. Using built-in XML serializationTo get the serializer to be used in xml handling: To serialize an object to xml: To deserialize a received xml to an object, given the object's class: To get the configuration for the xml serializer. One may need to convert the configuration instance to its true type, com.googlecode.flexxb.xml.XmlConfiguration in order to access all settings: To do an early processing of class types required for deserialization so as not to have problems when classes are not known: To register a custom annotation: To register a class type converter: In order to register a class descriptor created via the FlexXB API for classes that cannot be accessed in order to add annotations: com.googlecode.flexxb.core.FxBEngine.instance.api.processTypeDescriptor(apiTypeDescriptor) To provide an API descriptor file content in which the class descriptors are depicted in an XML format: Customizing serialization formatTo create a description context, the core of your custom serialization, extend com.googlecode.flexxb.core.DescriptionContext. Overridable methods:
To register the new serialization format context: com.googlecode.flexxb.core.FxBEngine.instance.registerDescriptionContext(name : String, context : DescriptionContext) : void To get the associated serializer: com.googlecode.flexxb.core.FxBEngine.instance.getSerializer(name : String) : IFlexXB To serialize an object to the custom format: To deserialize a received data ina custom format to an object, given the object's class: Using the apiIn order to register a class descriptor created via the FlexXB API for classes that cannot be accessed in order to add annotations: To provide an API descriptor file content in which the class descriptors are depicted in an XML format: | |