org.simpleframework.xml.strategy
Interface Value


public interface Value

The Value object describes a type that is represented by an XML element. This enables a Strategy to define not only the type an element represents, but also defines if that type needs to be created. This allows arrays as well as standard object types to be described. When instantiated the instance should be set on the value object for use by the strategy to detect cycles.

Author:
Niall Gallagher
See Also:
Strategy

Method Summary
 int getLength()
          This returns the length of the array that is to be allocated.
 java.lang.Class getType()
          This is the type of the object instance this represents.
 java.lang.Object getValue()
          This method is used to acquire an instance of the type that is defined by this object.
 boolean isReference()
          This will return true if the object represents a reference.
 void setValue(java.lang.Object value)
          This method is used set the value within this object.
 

Method Detail

getValue

java.lang.Object getValue()
This method is used to acquire an instance of the type that is defined by this object. If the value has not been set then this method will return null if this is not a reference.

Returns:
an instance of the type this object represents

setValue

void setValue(java.lang.Object value)
This method is used set the value within this object. Once this is set then the getValue method will return the object that has been provided for consistency.

Parameters:
value - this is the value to insert as the type

getType

java.lang.Class getType()
This is the type of the object instance this represents. The type returned by this is used to instantiate an object which will be set on this value and the internal graph maintained.

Returns:
the type of the object that must be instantiated

getLength

int getLength()
This returns the length of the array that is to be allocated. If this value does not represent an array then this should return zero to indicate that it is not an array object.

Returns:
this returns the number of elements for the array

isReference

boolean isReference()
This will return true if the object represents a reference. A reference will provide a valid instance when this objects getter is invoked. A valid instance can be a null.

Returns:
this returns true if this represents a reference