Package org.simpleframework.xml.core
Class OverrideValue
- java.lang.Object
-
- org.simpleframework.xml.core.OverrideValue
-
- All Implemented Interfaces:
Value
class OverrideValue extends java.lang.Object implements Value
TheOverrideValue
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.
-
-
Constructor Summary
Constructors Constructor Description OverrideValue(Value value, java.lang.Class type)
Constructor for theOverrideValue
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 instance)
This method is used set the value within this object.
-
-
-
Field Detail
-
value
private final Value value
This is the value that is used internally for this value.
-
type
private final java.lang.Class type
This is the type that is used to represent the value.
-
-
Constructor Detail
-
OverrideValue
public OverrideValue(Value value, java.lang.Class type)
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 Detail
-
getValue
public 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.
-
setValue
public void setValue(java.lang.Object instance)
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
public 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.
-
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
-
-