org.spicefactory.pimento.metamodel.impl
Class EntityClassMapping

java.lang.Object
  extended by org.spicefactory.cinnamon.io.mapping.AbstractClassMapping
      extended by org.spicefactory.pimento.metamodel.impl.EntityClassMapping
All Implemented Interfaces:
ClassMapping

public class EntityClassMapping
extends AbstractClassMapping

Cinnamon ClassMapping for persistent entities managed by Pimento. This is actually a "fake" ClassMapping since it will not be used by Cinnamon's AMF engine. It is only used for registration purposes.

Author:
Jens Halm

Constructor Summary
EntityClassMapping(String actionScriptClass, Class<?> javaClass)
          Creates a new instance.
 
Method Summary
 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 setEntity(Entity entity)
          Sets the entity metamodel for this class mapping.
 String toString()
           
 void writeObject(Object instance, AMFOutput output)
          Writes the content of the specified object to the given AMFOutput.
 
Methods inherited from class org.spicefactory.cinnamon.io.mapping.AbstractClassMapping
getActionScriptClass, getAlias, getEncoding, getJavaClass, getJavaFactory, getPropertyNames, setPropertyNames, writeClassDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EntityClassMapping

public EntityClassMapping(String actionScriptClass,
                          Class<?> javaClass)
Creates a new instance.

Parameters:
actionScriptClass - the name of the ActionScript class that maps to the specified Java class
javaClass - the Java class (a persistent entity class)
Method Detail

setEntity

public void setEntity(Entity entity)
Sets the entity metamodel for this class mapping.

Parameters:
entity - the entity metamodel for this class mapping

init

public void init(CinnamonConfig config)
Description copied from interface: ClassMapping
Initialization method that will be called once for each ClassMapping instance at application startup.

Parameters:
config - the Cinnamon configuration instance

newJavaInstance

public Object newJavaInstance()
Description copied from interface: ClassMapping
Creates a new instance of the mapped Java class.

Returns:
a new instance of the mapped Java class

readObject

public void readObject(Object instance,
                       AMFInput input,
                       ObjectEncoding encoding,
                       String[] propertyNames)
Description copied from interface: ClassMapping
Restores the content of the given object from the AMFInput instance.

Parameters:
instance - the object to be restored
input - the AMF3 data to read from
encoding - the type of object encoding to use
propertyNames - the names of the properties of the object (may be empty for some kinds of mappings)

writeObject

public void writeObject(Object instance,
                        AMFOutput output)
Description copied from interface: ClassMapping
Writes the content of the specified object to the given AMFOutput.

Parameters:
instance - the object to be serialized
output - the output to write to

toString

public String toString()
Overrides:
toString in class AbstractClassMapping