org.spicefactory.cinnamon.config.xml
Class ObjectConfig<T>

java.lang.Object
  extended by org.spicefactory.cinnamon.config.xml.ObjectConfig<T>

public class ObjectConfig<T>
extends Object

Represents a single object configured in XML.

Author:
Jens Halm

Constructor Summary
ObjectConfig()
           
 
Method Summary
 void addProperty(ConfigurationProperty property)
          Adds a configuration property for this object.
 T createInstance()
          Creates a new instance of the Class specified by the type property and applies all configuration properties to the newly created instance.
 Class<? extends T> getType()
          Returns the type of this object.
 void setType(Class<? extends T> type)
          Sets the type of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectConfig

public ObjectConfig()
Method Detail

setType

public void setType(Class<? extends T> type)
Sets the type of this object. The given class must have a default constructor (without arguments).

Parameters:
type - the type of this object

getType

public Class<? extends T> getType()
Returns the type of this object.

Returns:
the type of this object

addProperty

public void addProperty(ConfigurationProperty property)
Adds a configuration property for this object.

Parameters:
property - the configuration property to be added to this object.

createInstance

public T createInstance()
Creates a new instance of the Class specified by the type property and applies all configuration properties to the newly created instance.

Returns:
a new instance of the Class specified by the type property