Annotation Interface Root


@Retention(RUNTIME) public @interface Root
This Root annotation is used to annotate classes that need to be serialized. Also, elements within an element list, as represented by the ElementList annotation need this annotation so that the element names can be determined. All other field or method names can be determined using the annotation and so the Root annotation is not needed for such objects.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    This represents the name of the XML element.
    boolean
    This is used to determine whether the object represented should be parsed in a strict manner.
  • Element Details

    • name

      String name
      This represents the name of the XML element. This is optional an is used when the name of the class is not suitable as an element name. If this is not specified then the name of the XML element will be the name of the class. If specified the class will be serialized and deserialized with the given name.
      Returns:
      the name of the XML element this represents
      Default:
      ""
    • strict

      boolean strict
      This is used to determine whether the object represented should be parsed in a strict manner. Strict parsing requires that each element and attribute in the XML document match a field in the class schema. If an element or attribute does not match a field then the parsing fails with an exception. Setting strict parsing to false allows details within the source XML document to be skipped during deserialization.
      Returns:
      true if strict parsing is enabled, false otherwise
      Default:
      true