Class Structure

java.lang.Object
org.simpleframework.xml.core.Structure

class Structure extends Object
The Structure object represents the XML structure of an annotated class schema. A structure instance is an immutable object that contains all the criteria used in reading and writing and object. It provides a Section representing a tree structure of elements and attributes. Each section returned by the structure is a styled copy of the structured contents.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Instantiator
    This is the instantiator that is used to create instances.
    private final Model
    This contains the tree of XML elements and attributes used.
    private final boolean
    This is used to determine if the structure is a primitive.
    private final Label
    This is contains any text field or method in the class.
    private final Label
    This is the label representing the version of the class.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Structure(Instantiator factory, Model model, Label version, Label text, boolean primitive)
    Constructor for the Structure object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This is used to acquire the instantiator for the type.
    This is the Version for the scanned class.
    This is used to acquire the Section representing the class schema.
    This returns the Label that represents the text annotation for the schema class.
    This returns the Label that represents the version annotation for the schema class.
    boolean
    This is used to determine whether the schema class represents a primitive type.

    Methods inherited from class java.lang.Object

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

    • factory

      private final Instantiator factory
      This is the instantiator that is used to create instances.
    • version

      private final Label version
      This is the label representing the version of the class.
    • text

      private final Label text
      This is contains any text field or method in the class.
    • model

      private final Model model
      This contains the tree of XML elements and attributes used.
    • primitive

      private final boolean primitive
      This is used to determine if the structure is a primitive.
  • Constructor Details

    • Structure

      public Structure(Instantiator factory, Model model, Label version, Label text, boolean primitive)
      Constructor for the Structure object. A structure is created using all the established criteria for a schema that represents an annotated class. Once created the structure is immutable and is used to build XML sections.
      Parameters:
      factory - this is used to create new object instances
      model - the model representing the tree of XML elements
      version - this is the version associated with the class
      text - this represents any text field or method
      primitive - used to determine if this is primitive
  • Method Details

    • getInstantiator

      public Instantiator getInstantiator()
      This is used to acquire the instantiator for the type. This is used to create object instances based on the constructors that have been annotated. If no constructors have been annotated then this can be used to create default no argument instances.
      Returns:
      this instantiator responsible for creating instances
    • getSection

      public Section getSection()
      This is used to acquire the Section representing the class schema. A section is a tree like XML structure that contains all the details of the attributes and elements that form a section of the schema class. The context is provided to that the names can be styled if required.
      Returns:
      a section representing an XML section
    • isPrimitive

      public boolean isPrimitive()
      This is used to determine whether the schema class represents a primitive type. A primitive type is a type that contains no XML annotations and so cannot be serialized with an XML form. Instead primitives a serialized using transformations.
      Returns:
      this returns true if no XML annotations were found
    • getRevision

      public Version getRevision()
      This is the Version for the scanned class. It allows the deserialization process to be configured such that if the version is different from the schema class none of the fields and methods are required and unmatched elements and attributes will be ignored.
      Returns:
      this returns the version of the schema class
    • getVersion

      public Label getVersion()
      This returns the Label that represents the version annotation for the schema class. Only a single version can exist within the class if more than one exists an exception is thrown. This will read only floating point types such as double.
      Returns:
      this returns the label used for reading the version
    • getText

      public Label getText()
      This returns the Label that represents the text annotation for the schema class. Only a single text annotation can be used per class, so this returns only a single label rather than a LabelMap object. Also if this is not null then the section returned must be empty.
      Returns:
      this returns the text label for the schema class