Package org.simpleframework.xml.strategy
Interface Value
- All Known Implementing Classes:
Allocate
,ArrayValue
,ObjectValue
,OverrideValue
,Reference
,Reference
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.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
This returns the length of the array that is to be allocated.getType()
This is the type of the object instance this represents.getValue()
This method is used to acquire an instance of the type that is defined by this object.boolean
This will return true if the object represents a reference.void
This method is used set the value within this object.
-
Method Details
-
getValue
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
This method is used set the value within this object. Once this is set then thegetValue
method will return the object that has been provided for consistency.- Parameters:
value
- this is the value to insert as the type
-
getType
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
-