org.jfree.xml.factory.objects

Interface ObjectDescription

public interface ObjectDescription extends Serializable

An interface for object descriptions.

Author: Thomas Morgner

Method Summary
voidconfigure(Configuration config)
Configures this factory.
ObjectcreateObject()
Creates an object based on the description.
booleanequals(Object o)
Compares whether two object descriptions are equal.
ObjectDescriptiongetInstance()
Returns a cloned instance of the object description.
ClassgetObjectClass()
Returns the object class.
ObjectgetParameter(String name)
Returns the value of a parameter.
ClassgetParameterDefinition(String name)
Returns a parameter definition.
IteratorgetParameterNames()
Returns an iterator the provides access to the parameter names.
ObjectDescriptiongetUnconfiguredInstance()
Returns a cloned instance of the object description.
inthashCode()
Computes the hashCode for this ClassFactory.
voidsetParameter(String name, Object value)
Sets the value of a parameter.
voidsetParameterFromObject(Object o)
Sets the parameters of this description object to match the supplied object.

Method Detail

configure

public void configure(Configuration config)
Configures this factory. The configuration contains several keys and their defined values. The given reference to the configuration object will remain valid until the report parsing or writing ends.

The configuration contents may change during the reporting.

Parameters: config the configuration, never null

createObject

public Object createObject()
Creates an object based on the description.

Returns: The object.

equals

public boolean equals(Object o)
Compares whether two object descriptions are equal.

Parameters: o the other object.

Returns: true, if both object desciptions describe the same object, false otherwise.

getInstance

public ObjectDescription getInstance()
Returns a cloned instance of the object description. The contents of the parameter objects collection are cloned too, so that any already defined parameter value is copied to the new instance.

Parameter definitions are not cloned, as they are considered read-only.

Returns: A cloned instance.

getObjectClass

public Class getObjectClass()
Returns the object class.

Returns: The Class.

getParameter

public Object getParameter(String name)
Returns the value of a parameter.

Parameters: name the parameter name.

Returns: The value.

getParameterDefinition

public Class getParameterDefinition(String name)
Returns a parameter definition. If the parameter is invalid, this function returns null.

Parameters: name the definition name.

Returns: The parameter class or null, if the parameter is not defined.

getParameterNames

public Iterator getParameterNames()
Returns an iterator the provides access to the parameter names. This returns all _known_ parameter names, the object description may accept additional parameters.

Returns: The iterator.

getUnconfiguredInstance

public ObjectDescription getUnconfiguredInstance()
Returns a cloned instance of the object description. The contents of the parameter objects collection are cloned too, so that any already defined parameter value is copied to the new instance.

Parameter definitions are not cloned, as they are considered read-only.

The newly instantiated object description is not configured. If it need to be configured, then you have to call configure on it.

Returns: A cloned instance.

hashCode

public int hashCode()
Computes the hashCode for this ClassFactory. As equals() must be implemented, a corresponding hashCode() should be implemented as well.

Returns: the hashcode.

setParameter

public void setParameter(String name, Object value)
Sets the value of a parameter.

Parameters: name the parameter name. value the parameter value.

setParameterFromObject

public void setParameterFromObject(Object o)
Sets the parameters of this description object to match the supplied object.

Parameters: o the object.

Throws: ObjectFactoryException if there is a problem while reading the properties of the given object.