org.spicefactory.cinnamon.io.mapping
Class AbstractClassMapping

java.lang.Object
  extended by org.spicefactory.cinnamon.io.mapping.AbstractClassMapping
All Implemented Interfaces:
ClassMapping
Direct Known Subclasses:
AbstractPropertyClassMapping, EntityClassMapping, ExternalizableClassMapping

public abstract class AbstractClassMapping
extends Object
implements ClassMapping

Abstract base class for all ClassMapping implementations.

Author:
Jens Halm

Constructor Summary
protected AbstractClassMapping(String alias, String actionScriptClass, Class<?> javaClass, Class<?> javaFactory, ObjectEncoding encoding)
          Creates a new ClassMapping instance.
 
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.
protected  ObjectEncoding getEncoding()
          Returns the object encoding for this mapping.
 Class<?> getJavaClass()
          Returns the Java class for this mapping.
protected  Class<?> getJavaFactory()
          Returns the (optional) Java factory for this mapping.
protected  String[] getPropertyNames()
          Returns the property names of the mapped class.
protected  void setPropertyNames(String[] propertyNames)
          Sets the property names of the mapped class.
 String toString()
           
 void writeClassDescriptor(Object instance, AMFOutput output)
          Writes the class descriptor for the specified object to the given AMFOutput.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.spicefactory.cinnamon.io.mapping.ClassMapping
init, newJavaInstance, readObject, writeObject
 

Constructor Detail

AbstractClassMapping

protected AbstractClassMapping(String alias,
                               String actionScriptClass,
                               Class<?> javaClass,
                               Class<?> javaFactory,
                               ObjectEncoding encoding)
Creates a new ClassMapping instance.

Parameters:
alias - the alias for this mapping
actionScriptClass - the fully qualified ActionScript class name
javaClass - the Java class
javaFactory - the (optional) Java factory
encoding - the object encoding for this mapping
Method Detail

setPropertyNames

protected void setPropertyNames(String[] propertyNames)
Sets the property names of the mapped class.

Parameters:
propertyNames - the property names of the mapped class

getAlias

public String getAlias()
Description copied from interface: ClassMapping
Returns the alias that was registered for this mapping. This must match the value that was set in ActionScript with registerClassAlias or the [RemoteClass] metadata tag.

Specified by:
getAlias in interface ClassMapping
Returns:
the alias for this mapping

getActionScriptClass

public String getActionScriptClass()
Description copied from interface: ClassMapping
Returns the fully qualified name of the ActionScript 3 class for this mapping.

Specified by:
getActionScriptClass in interface ClassMapping
Returns:
the fully qualified name of the ActionScript 3 class

getJavaClass

public Class<?> getJavaClass()
Description copied from interface: ClassMapping
Returns the Java class for this mapping.

Specified by:
getJavaClass in interface ClassMapping
Returns:
the Java class for this mapping

getJavaFactory

protected Class<?> getJavaFactory()
Returns the (optional) Java factory for this mapping. May return null.

Returns:
the Java factory for this mapping or null if none was specified.

getEncoding

protected ObjectEncoding getEncoding()
Returns the object encoding for this mapping.

Returns:
the object encoding for this mapping

getPropertyNames

protected String[] getPropertyNames()
Returns the property names of the mapped class.

Returns:
the property names of the mapped class

writeClassDescriptor

public void writeClassDescriptor(Object instance,
                                 AMFOutput output)
Description copied from interface: ClassMapping
Writes the class descriptor for the specified object to the given AMFOutput.

Specified by:
writeClassDescriptor in interface ClassMapping
Parameters:
instance - the object a class descriptor should be written for
output - the output to write to

toString

public String toString()
Overrides:
toString in class Object