Package org.simpleframework.xml.strategy
Class Reference
java.lang.Object
org.simpleframework.xml.strategy.Reference
- All Implemented Interfaces:
Value
The
Reference
object represents an object that
is used to provide a reference to an already instantiated value.
This is what is used if there is a cycle in the object graph.
The getValue
method of this object will simply
return the object instance that was previously created.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
This returns zero as this is a reference and will typically not be used to instantiate anything.getType()
This returns the type for the object that this references.getValue()
This is used to acquire a reference to the instance that is taken from the created object graph.boolean
This always returns true for this object.void
This method is used set the value within this object.
-
Field Details
-
value
This is the object instance that has already be created. -
type
This is the type of the object that this references.
-
-
Constructor Details
-
Reference
Constructor for theReference
object. This is used to create a value that will produce the specified value when thegetValue
method is invoked.- Parameters:
value
- the value for the reference this representstype
- this is the type value for the instance
-
-
Method Details
-
getValue
This is used to acquire a reference to the instance that is taken from the created object graph. This enables any cycles in the graph to be reestablished from the persisted XML. -
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. Typically this will not be set as this represents a reference value. -
getType
This returns the type for the object that this references. This will basically return thegetClass
class from the referenced instance. This is used to ensure that the type this represents is compatible to the object field. -
getLength
public int getLength()This returns zero as this is a reference and will typically not be used to instantiate anything. If the reference is an an array then this can not be used to instantiate it. -
isReference
public boolean isReference()This always returns true for this object. This indicates to the deserialization process that there should be not further deserialization of the object from the XML source stream.- Specified by:
isReference
in interfaceValue
- Returns:
- because this is a reference this is always true
-