Package org.simpleframework.xml.core
Class OverrideValue
java.lang.Object
org.simpleframework.xml.core.OverrideValue
- All Implemented Interfaces:
Value
The
OverrideValue
is used to represent a value that
contains an override type. Providing a value in this way ensures
that should an XML element not contain any data representing
the type of object then the type data can be provided.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOverrideValue
(Value value, Class type) Constructor for theOverrideValue
object. -
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.
-
Field Details
-
value
This is the value that is used internally for this value. -
type
This is the type that is used to represent the value.
-
-
Constructor Details
-
OverrideValue
Constructor for theOverrideValue
object. This will delegate to an internal value instance but will provide the declared type when requested.- Parameters:
value
- this is the value that this will delegate totype
- this is the override type for this value
-
-
Method Details
-
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. -
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. -
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. -
getLength
public 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. -
isReference
public 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.- Specified by:
isReference
in interfaceValue
- Returns:
- this returns true if this represents a reference
-