Class Contract

java.lang.Object
org.simpleframework.xml.strategy.Contract

class Contract extends Object
The Contract object is used to expose the attribute names used by the cycle strategy. This ensures that reading and writing of the XML document is done in a consistent manner. Each attribute is used to mark special meta-data for the object graph.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    This is the label used to mark the type of an object.
    private String
    This is used to specify the length of array instances.
    private String
    This is the attribute used to mark the identity of an object.
    private String
    This is the attribute used to refer to an existing instance.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Contract(String mark, String refer, String label, String length)
    Constructor for the Syntax object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This returns the attribute used to store the identities of all objects serialized to the XML document.
    This is returns the attribute used to store information about the type to the XML document.
    This returns the attribute used to store the array length in the serialized XML document.
    This returns the attribute used to store references within the serialized XML document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • length

      private String length
      This is used to specify the length of array instances.
    • label

      private String label
      This is the label used to mark the type of an object.
    • mark

      private String mark
      This is the attribute used to mark the identity of an object.
    • refer

      private String refer
      This is the attribute used to refer to an existing instance.
  • Constructor Details

    • Contract

      public Contract(String mark, String refer, String label, String length)
      Constructor for the Syntax object. This is used to expose the attribute names used by the strategy. All the names can be acquired and shared by the read and write graph objects, which ensures consistency between the two objects.
      Parameters:
      mark - this is used to mark the identity of an object
      refer - this is used to refer to an existing object
      label - this is used to specify the class for the field
      length - this is the length attribute used for arrays
  • Method Details

    • getLabel

      public String getLabel()
      This is returns the attribute used to store information about the type to the XML document. This attribute name is used to add data to XML elements to enable the deserialization process to know the exact instance to use when creating a type.
      Returns:
      the name of the attribute used to store the type
    • getReference

      public String getReference()
      This returns the attribute used to store references within the serialized XML document. The reference attribute is added to the serialized XML element so that cycles in the object graph can be recreated. This is an optional attribute.
      Returns:
      this returns the name of the reference attribute
    • getIdentity

      public String getIdentity()
      This returns the attribute used to store the identities of all objects serialized to the XML document. The identity attribute stores a unique identifiers, which enables this strategy to determine an objects identity within the serialized XML.
      Returns:
      this returns the name of the identity attribute used
    • getLength

      public String getLength()
      This returns the attribute used to store the array length in the serialized XML document. The array length is required so that the deserialization process knows how to construct the array before any of the array elements are deserialized.
      Returns:
      this returns the name of the array length attribute