Package org.simpleframework.xml.convert
Class Reference
java.lang.Object
org.simpleframework.xml.convert.Reference
- All Implemented Interfaces:
Value
The
Reference
object represents a value that holds
an object instance. If an object instance is to be provided from
a Strategy
implementation it must be wrapped in a
value object. The value object can then provide the details of
the instance and the actual object instance to the serializer.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
This will return the length of an array reference.getType()
This is the type of the object instance this represents.getValue()
This returns the actual object instance that is held by this reference object.boolean
This will always return true as thisValue
object will always contain an object instance.void
This is used to set the value of the object.
-
Field Details
-
value
This represents the original value returned from a strategy. -
data
This represents the object instance that this represents. -
actual
This is the actual type of the reference that is represented.
-
-
Constructor Details
-
Reference
Constructor for aReference
object. To create this a value and an object instance is required. The value provided may be null, but the instance should be a valid object instance to be used by the serializer.- Parameters:
value
- this is the original value from a strategydata
- this is the object instance that is wrappedactual
- this is the overriding type of the reference
-
-
Method Details
-
getLength
public int getLength()This will return the length of an array reference. Because the value will represent the value itself the length is never used, as no instance needs to be created. -
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. -
getValue
This returns the actual object instance that is held by this reference object. -
isReference
public boolean isReference()This will always return true as thisValue
object will always contain an object instance. Returning true from this method tells the serializer that there is no need to actually perform any further deserialization.- Specified by:
isReference
in interfaceValue
- Returns:
- this always returns true as this will be a reference
-
setValue
This is used to set the value of the object. If the internalValue
is not null then the internal value will have the instance set also.
-