Package org.simpleframework.xml.core
Class Structure
java.lang.Object
org.simpleframework.xml.core.Structure
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
FieldsModifier and TypeFieldDescriptionprivate 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
ConstructorsConstructorDescriptionStructure
(Instantiator factory, Model model, Label version, Label text, boolean primitive) Constructor for theStructure
object. -
Method Summary
Modifier and TypeMethodDescriptionThis is used to acquire the instantiator for the type.This is theVersion
for the scanned class.This is used to acquire theSection
representing the class schema.getText()
This returns theLabel
that represents the text annotation for the schema class.This returns theLabel
that represents the version annotation for the schema class.boolean
This is used to determine whether the schema class represents a primitive type.
-
Field Details
-
factory
This is the instantiator that is used to create instances. -
version
This is the label representing the version of the class. -
text
This is contains any text field or method in the class. -
model
This contains the tree of XML elements and attributes used. -
primitive
private final boolean primitiveThis is used to determine if the structure is a primitive.
-
-
Constructor Details
-
Structure
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 Details
-
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
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
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
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
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
-