Package org.simpleframework.xml.core
Class Structure
- java.lang.Object
-
- org.simpleframework.xml.core.Structure
-
class Structure extends java.lang.Object
TheStructure
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 aSection
representing a tree structure of elements and attributes. Each section returned by the structure is a styled copy of the structured contents.- See Also:
StructureBuilder
,Section
-
-
Field Summary
Fields Modifier and Type Field Description private Instantiator
factory
This is the instantiator that is used to create instances.private Model
model
This contains the tree of XML elements and attributes used.private boolean
primitive
This is used to determine if the structure is a primitive.private Label
text
This is contains any text field or method in the class.private Label
version
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 theStructure
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instantiator
getInstantiator()
This is used to acquire the instantiator for the type.Version
getRevision()
This is theVersion
for the scanned class.Section
getSection()
This is used to acquire theSection
representing the class schema.Label
getText()
This returns theLabel
that represents the text annotation for the schema class.Label
getVersion()
This returns theLabel
that represents the version annotation for the schema class.boolean
isPrimitive()
This is used to determine whether the schema class represents a primitive type.
-
-
-
Field Detail
-
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 Detail
-
Structure
public Structure(Instantiator factory, Model model, Label version, Label text, boolean primitive)
Constructor for theStructure
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 instancesmodel
- the model representing the tree of XML elementsversion
- this is the version associated with the classtext
- this represents any text field or methodprimitive
- used to determine if this is primitive
-
-
Method Detail
-
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 theSection
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 theVersion
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 theLabel
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 theLabel
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 aLabelMap
object. Also if this is not null then the section returned must be empty.- Returns:
- this returns the text label for the schema class
-
-