Class Variable.Adapter

java.lang.Object
org.simpleframework.xml.core.Variable.Adapter
All Implemented Interfaces:
Converter, Repeater
Enclosing class:
Variable

private static class Variable.Adapter extends Object implements Repeater
The Adapter object is used to call the repeater with the original deserialized object. Using this object the converter interface can be used to perform repeat reads for the object. This must be given a Repeater in order to invoke the repeat read method.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Label
    This contains the details for the annotated field or method.
    private final Converter
    This is the converter object used to perform a repeat read.
    private final Object
    This is the originally deserialized object value to use.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Adapter(Converter reader, Label label, Object value)
    Constructor for the Adapter object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This read method will perform a read using the provided object with the repeater.
    read(InputNode node, Object value)
    This read method will perform a read using the provided object with the repeater.
    boolean
    This read method will perform a read using the provided object with the repeater.
    void
    write(OutputNode node, Object value)
    This write method acts like any other write in that it passes on the node and source object to write.

    Methods inherited from class java.lang.Object

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

    • reader

      private final Converter reader
      This is the converter object used to perform a repeat read.
    • value

      private final Object value
      This is the originally deserialized object value to use.
    • label

      private final Label label
      This contains the details for the annotated field or method.
  • Constructor Details

    • Adapter

      public Adapter(Converter reader, Label label, Object value)
      Constructor for the Adapter object. This will create an adapter between the converter an repeater such that the reads will read from the XML to the original.
      Parameters:
      reader - this is the converter object to be used
      value - this is the originally deserialized object
  • Method Details

    • read

      public Object read(InputNode node) throws Exception
      This read method will perform a read using the provided object with the repeater. Reading with this method ensures that any additional XML elements within the source will be added to the value.
      Specified by:
      read in interface Converter
      Parameters:
      node - this is the node that contains the extra data
      Returns:
      this will return the original deserialized object
      Throws:
      Exception - if a deserialized type cannot be instantiated
    • read

      public Object read(InputNode node, Object value) throws Exception
      This read method will perform a read using the provided object with the repeater. Reading with this method ensures that any additional XML elements within the source will be added to the value.
      Specified by:
      read in interface Converter
      Specified by:
      read in interface Repeater
      Parameters:
      node - this is the node that contains the extra data
      value - this is the value to read the objects in to
      Returns:
      this will return the original deserialized object
      Throws:
      Exception - if a deserialized type cannot be instantiated
    • validate

      public boolean validate(InputNode node) throws Exception
      This read method will perform a read using the provided object with the repeater. Reading with this method ensures that any additional XML elements within the source will be added to the value.
      Specified by:
      validate in interface Converter
      Parameters:
      node - this is the node that contains the extra data
      Returns:
      this will return the original deserialized object
      Throws:
      Exception - if the class XML schema does not fully match
    • write

      public void write(OutputNode node, Object value) throws Exception
      This write method acts like any other write in that it passes on the node and source object to write. Typically this will not be used as the repeater object is used for repeat reads of scattered XML elements.
      Specified by:
      write in interface Converter
      Parameters:
      node - this is the node to write the data to
      value - this is the source object to be written
      Throws:
      Exception - throw if the object cannot be serialized