Class OverrideType

java.lang.Object
org.simpleframework.xml.core.OverrideType
All Implemented Interfaces:
Type

class OverrideType extends Object implements Type
The OverrideType is used to represent a type as class other than that defined in a containing type. This can be used to ensure that a union type does not have to have an attribute defining its type serialized in to the resulting XML.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Class
    This is the override that is used to represent the type.
    private final Type
    This is the type associated with this override type.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OverrideType(Type type, Class override)
    Constructor for the OverrideType object.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends Annotation>
    T
    getAnnotation(Class<T> label)
    This is the annotation associated with the method or field that has been annotated.
    This will provide the method or field type.
    This is used to describe the type as it exists within the owning class.

    Methods inherited from class java.lang.Object

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

    • override

      private final Class override
      This is the override that is used to represent the type.
    • type

      private final Type type
      This is the type associated with this override type.
  • Constructor Details

    • OverrideType

      public OverrideType(Type type, Class override)
      Constructor for the OverrideType object. This is used to create a type object that has an override type which is can be used to ensure serialization does not require any extra data containing the class name of the type instance.
      Parameters:
      type - this is the type used internally for this
      override - this is the override type to use
  • Method Details

    • getAnnotation

      public <T extends Annotation> T getAnnotation(Class<T> label)
      This is the annotation associated with the method or field that has been annotated. If this represents an entry to a Java collection such as a java.util.List then this will return null for any annotation requested.
      Specified by:
      getAnnotation in interface Type
      Parameters:
      label - this is the type of the annotation to acquire
      Returns:
      this provides the annotation associated with this
    • getType

      public Class getType()
      This will provide the method or field type. The type is the class that is to be read and written on the object. Typically the type will be a serializable object or a primitive type.
      Specified by:
      getType in interface Type
      Returns:
      this returns the type for this method o field
    • toString

      public String toString()
      This is used to describe the type as it exists within the owning class. This is used to provide error messages that can be used to debug issues that occur when processing.
      Specified by:
      toString in interface Type
      Overrides:
      toString in class Object
      Returns:
      this returns a string representation of the type