Package org.simpleframework.xml.convert
Class Reference
- java.lang.Object
-
- org.simpleframework.xml.convert.Reference
-
- All Implemented Interfaces:
Value
class Reference extends java.lang.Object implements Value
TheReferenceobject represents a value that holds an object instance. If an object instance is to be provided from aStrategyimplementation 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 Modifier and Type Field Description private java.lang.ClassactualThis is the actual type of the reference that is represented.private java.lang.ObjectdataThis represents the object instance that this represents.private ValuevalueThis represents the original value returned from a strategy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLength()This will return the length of an array reference.java.lang.ClassgetType()This is the type of the object instance this represents.java.lang.ObjectgetValue()This returns the actual object instance that is held by this reference object.booleanisReference()This will always return true as thisValueobject will always contain an object instance.voidsetValue(java.lang.Object data)This is used to set the value of the object.
-
-
-
Field Detail
-
value
private Value value
This represents the original value returned from a strategy.
-
data
private java.lang.Object data
This represents the object instance that this represents.
-
actual
private java.lang.Class actual
This is the actual type of the reference that is represented.
-
-
Constructor Detail
-
Reference
public Reference(Value value, java.lang.Object data, java.lang.Class actual)
Constructor for aReferenceobject. 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 Detail
-
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
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.
-
getValue
public java.lang.Object getValue()
This returns the actual object instance that is held by this reference object.
-
isReference
public boolean isReference()
This will always return true as thisValueobject 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:
isReferencein interfaceValue- Returns:
- this always returns true as this will be a reference
-
-