Packagecom.pblabs.engine.serialization
Classpublic class Serializer
InheritanceSerializer Inheritance Object

Singleton class for serializing and deserializing objects. This class implements a default serialization behavior based on the format described in the XMLFormat reference. This default behavior can be replaced on a class by class basis by implementing the ISerializable interface.

See also

ISerializable


Public Properties
 PropertyDefined By
  instance : Serializer
[static] [read-only] Gets the singleton instance of the Serializer class.
Serializer
Public Methods
 MethodDefined By
  
Serializer
  
Clear the entity relative to which current serialization work is happening.
Serializer
  
deserialize(object:*, xml:XML, typeHint:String = null):*
Deserializes an object from an xml description.
Serializer
  
removeResource(filename:String):void
Serializer
  
Not all references are resolved immediately.
Serializer
  
reportXMLPath(item:*):String
Given an XML element, walk up its parent references and show the path in the document, including any name attributes.
Serializer
  
Serializer
  
serialize(object:*, xml:XML):void
Serializes an object to XML.
Serializer
  
Set the entity relative to which current serialization work is happening.
Serializer
Property Detail
instanceproperty
instance:Serializer  [read-only]

Gets the singleton instance of the Serializer class.


Implementation
    public static function get instance():Serializer
Constructor Detail
Serializer()Constructor
public function Serializer()



Method Detail
clearCurrentEntity()method
public function clearCurrentEntity():void

Clear the entity relative to which current serialization work is happening. Mostly for internal use.

deserialize()method 
public function deserialize(object:*, xml:XML, typeHint:String = null):*

Deserializes an object from an xml description.

Parameters

object:* — The object on which the xml description will be applied.
 
xml:XML — The xml to deserialize from.
 
typeHint:String (default = null) — For an array, dictionary, or dynamic class, a type hint can be specified as to what its children should be. Optional.

Returns
* — A reference to the deserialized object. This is always the same as the object parameter, with the exception of types that are passed by value. Code that calls this method should always use the return value rather than the passed in value for this reason.
removeResource()method 
public function removeResource(filename:String):void

Parameters

filename:String

reportMissingReferences()method 
public function reportMissingReferences():void

Not all references are resolved immediately. In order to minimize spam, we only report "dangling references" at certain times. This method triggers such a report.

reportXMLPath()method 
public function reportXMLPath(item:*):String

Given an XML element, walk up its parent references and show the path in the document, including any name attributes.

Parameters

item:*

Returns
String
resolveReferences()method 
public function resolveReferences():void

serialize()method 
public function serialize(object:*, xml:XML):void

Serializes an object to XML. This is currently not implemented.

Parameters

object:* — The object to serialize. If this object implements ISerializable, its serialize method will be called to do the serialization, otherwise the default behavior will be used.
 
xml:XML

See also

setCurrentEntity()method 
public function setCurrentEntity(e:IEntity):void

Set the entity relative to which current serialization work is happening. Mostly for internal use.

Parameters

e:IEntity