Package org.simpleframework.xml.core
Class TextList
- java.lang.Object
-
- org.simpleframework.xml.core.TextList
-
class TextList extends java.lang.Object implements Repeater
ThisTextList
object is a converter that is used to read free text and insert that text in to a list. Collecting free text in this way allows unstructured XML to be processed and stored in an ordered way, which will allow it to be written as identical XML during the serialization process.
-
-
Field Summary
Fields Modifier and Type Field Description private CollectionFactory
factory
This is the factory that is used to create the containing list.private Primitive
primitive
This is the primitive object used to read the free text.private Type
type
This is a string type which is used for all free text data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
read(InputNode node)
Theread
method reads an object to a specific type from the provided node.java.lang.Object
read(InputNode node, java.lang.Object result)
Theread
method reads an object to a specific type from the provided node.boolean
validate(InputNode node)
Thevalidate
method is used to validate the class XML schema against an input source.void
write(OutputNode node, java.lang.Object object)
Thewrite
method writes the fields from the given object to the XML element.
-
-
-
Field Detail
-
factory
private final CollectionFactory factory
This is the factory that is used to create the containing list.
-
primitive
private final Primitive primitive
This is the primitive object used to read the free text.
-
type
private final Type type
This is a string type which is used for all free text data.
-
-
Constructor Detail
-
TextList
public TextList(Context context, Type list, Label label)
Constructor for theTextList
object. This is used to create a converter that can read free text from between elements in anElementListUnion
. Converting the free text in this way allows unstructured XML to be processed.- Parameters:
context
- this is the context that is used for thislist
- this is the list type this will be used withlabel
- this is the label this the text is declared with
-
-
Method Detail
-
read
public java.lang.Object read(InputNode node) throws java.lang.Exception
Theread
method reads an object to a specific type from the provided node. If the node provided is an attribute then the object must be a primitive such as a string, integer, boolean, or any of the other Java primitive types.
-
read
public java.lang.Object read(InputNode node, java.lang.Object result) throws java.lang.Exception
Theread
method reads an object to a specific type from the provided node. If the node provided is an attribute then the object must be a primitive such as a string, integer, boolean, or any of the other Java primitive types.- Specified by:
read
in interfaceConverter
- Specified by:
read
in interfaceRepeater
- Parameters:
node
- contains the details used to deserialize the objectvalue
- this is the value to read the objects in to- Returns:
- a fully deserialized object will all its fields
- Throws:
java.lang.Exception
- if a deserialized type cannot be instantiated
-
validate
public boolean validate(InputNode node) throws java.lang.Exception
Thevalidate
method is used to validate the class XML schema against an input source. This will traverse the class fields and methods ensuring that the input XML document contains a valid structure when compared against the class XML schema.
-
write
public void write(OutputNode node, java.lang.Object object) throws java.lang.Exception
Thewrite
method writes the fields from the given object to the XML element. After this has finished the element contains all attributes and sub-elements from the object.
-
-