org.spicefactory.cinnamon.io.mapping
Class AnonymousClassMapping

java.lang.Object
  extended by org.spicefactory.cinnamon.io.mapping.AbstractClassMapping
      extended by org.spicefactory.cinnamon.io.mapping.AbstractPropertyClassMapping
          extended by org.spicefactory.cinnamon.io.mapping.AnonymousClassMapping
All Implemented Interfaces:
ClassMapping

public class AnonymousClassMapping
extends AbstractPropertyClassMapping

AnonymousClassMapping handles ActionScript objects for which no alias was registered in ActionScript. These objects will be mapped to instances of java.util.Map and the properties of the ActionScript object will be mapped to the corresponding key/value pairs of the Map, with the keys representing the name of the property.

An instance of this class will be automatically registered in each Cinnamon application.

Author:
Jens Halm

Constructor Summary
AnonymousClassMapping()
          Creates a new anonymous class mapping.
 
Method Summary
protected  Object getProperty(Object instance, String propertyName)
          Reads the property with the given name from the specified target instance.
 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.
protected  void setProperty(Object instance, String propertyName, Object value)
          Sets the property on the given target instance to the specified value.
 
Methods inherited from class org.spicefactory.cinnamon.io.mapping.AbstractPropertyClassMapping
readObject, writeObject
 
Methods inherited from class org.spicefactory.cinnamon.io.mapping.AbstractClassMapping
getActionScriptClass, getAlias, getEncoding, getJavaClass, getJavaFactory, getPropertyNames, setPropertyNames, toString, writeClassDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnonymousClassMapping

public AnonymousClassMapping()
Creates a new anonymous class mapping.

Method Detail

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

getProperty

protected Object getProperty(Object instance,
                             String propertyName)
Description copied from class: AbstractPropertyClassMapping
Reads the property with the given name from the specified target instance.

Specified by:
getProperty in class AbstractPropertyClassMapping
Parameters:
instance - the instance to read the property from
propertyName - the name of the property
Returns:
the value of the property

setProperty

protected void setProperty(Object instance,
                           String propertyName,
                           Object value)
Description copied from class: AbstractPropertyClassMapping
Sets the property on the given target instance to the specified value.

Specified by:
setProperty in class AbstractPropertyClassMapping
Parameters:
instance - the instance to set the property on
propertyName - the name of the property
value - the new value of the property