|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ClassMapping
A class mapping instance encapsulates information and logic needed to map an ActionScript 3 class to a corresponding Java class. This includes properties for the alias and the mapped ActionScript and Java classes, a method to create a new instance of the mapped Java class and methods to read or write objects to/from AMF3 binary data.
Cinnamon includes implementations for three types of class mappings, representing the capabilities of the AMF3 format.
flash.utils.IExternalizable and have an alias registered in ActionScript
with flash.net.registerClassAlias or the [RemoteClass] metadata tag.
On the Java side the mapped class must
implement org.spicefactory.cinnamon.io.Externalizable and read/write to/from the AMF3 data.
Alternatively a separate class implementing org.spicefactory.cinnamon.io.Externalizer
may be used to perform that task. This mapping type gives you the most control over the details
of AMF3 serialization but involves custom development since the mapped objects take care of IO themselvesIExternalizable
but do have an alias registered in ActionScript with flash.net.registerClassAlias
or the [RemoteClass] metadata tag.
In this case the properties of the ActionScript class will be mapped to properties of a
Java bean, following standard Java Bean conventions. This mapping type gives you less control
over the mapping details but works out of the box. It can be tweaked with custom Converters for
properties whose ActionScript data type does not match the data type of the corresponding
Java property.
| Method Summary | |
|---|---|
String |
getActionScriptClass()
Returns the fully qualified name of the ActionScript 3 class for this mapping. |
String |
getAlias()
Returns the alias that was registered for this mapping. |
Class<?> |
getJavaClass()
Returns the Java class for this mapping. |
void |
init(CinnamonConfig config)
Initialization method that will be called once for each ClassMapping instance at application startup. |
Object |
newJavaInstance()
Creates a new instance of the mapped Java class. |
void |
readObject(Object instance,
AMFInput input,
ObjectEncoding encoding,
String[] propertyNames)
Restores the content of the given object from the AMFInput instance. |
void |
writeClassDescriptor(Object instance,
AMFOutput output)
Writes the class descriptor for the specified object to the given AMFOutput. |
void |
writeObject(Object instance,
AMFOutput output)
Writes the content of the specified object to the given AMFOutput. |
| Method Detail |
|---|
void init(CinnamonConfig config)
config - the Cinnamon configuration instanceString getAlias()
registerClassAlias
or the [RemoteClass] metadata tag.
String getActionScriptClass()
Class<?> getJavaClass()
Object newJavaInstance()
void readObject(Object instance,
AMFInput input,
ObjectEncoding encoding,
String[] propertyNames)
instance - the object to be restoredinput - the AMF3 data to read fromencoding - the type of object encoding to usepropertyNames - the names of the properties of the object (may be empty for some kinds of mappings)
void writeObject(Object instance,
AMFOutput output)
instance - the object to be serializedoutput - the output to write to
void writeClassDescriptor(Object instance,
AMFOutput output)
instance - the object a class descriptor should be written foroutput - the output to write to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||