Class TextList

java.lang.Object
org.simpleframework.xml.core.TextList
All Implemented Interfaces:
Converter, Repeater

class TextList extends Object implements Repeater
This TextList 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 final CollectionFactory
    This is the factory that is used to create the containing list.
    private final Primitive
    This is the primitive object used to read the free text.
    private final Type
    This is a string type which is used for all free text data.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextList(Context context, Type list, Label label)
    Constructor for the TextList object.
  • Method Summary

    Modifier and Type
    Method
    Description
    The read method reads an object to a specific type from the provided node.
    read(InputNode node, Object result)
    The read method reads an object to a specific type from the provided node.
    boolean
    The validate method is used to validate the class XML schema against an input source.
    void
    write(OutputNode node, Object object)
    The write method writes the fields from the given object to the XML element.

    Methods inherited from class java.lang.Object

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

    • 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 Details

    • TextList

      public TextList(Context context, Type list, Label label)
      Constructor for the TextList object. This is used to create a converter that can read free text from between elements in an ElementListUnion. Converting the free text in this way allows unstructured XML to be processed.
      Parameters:
      context - this is the context that is used for this
      list - this is the list type this will be used with
      label - this is the label this the text is declared with
  • Method Details

    • read

      public Object read(InputNode node) throws Exception
      The read 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 interface Converter
      Parameters:
      node - contains the details used to deserialize the object
      Returns:
      a fully deserialized object will all its fields
      Throws:
      Exception - if a deserialized type cannot be instantiated
    • read

      public Object read(InputNode node, Object result) throws Exception
      The read 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 interface Converter
      Specified by:
      read in interface Repeater
      Parameters:
      node - contains the details used to deserialize the object
      result - this is the value to read the objects in to
      value - this is the value to read the objects in to
      Returns:
      a fully deserialized object will all its fields
      Throws:
      Exception - if a deserialized type cannot be instantiated
    • validate

      public boolean validate(InputNode node) throws Exception
      The validate 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.
      Specified by:
      validate in interface Converter
      Parameters:
      node - contains the details used to validate the object
      Returns:
      true if the document matches the class XML schema
      Throws:
      Exception - if the class XML schema does not fully match
    • write

      public void write(OutputNode node, Object object) throws Exception
      The write 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.
      Specified by:
      write in interface Converter
      Parameters:
      node - this is the element that is to be populated
      object - this is the object to be written to the element
      Throws:
      Exception - throw if the object cannot be serialized