Annotation Interface Default


@Retention(RUNTIME) public @interface Default
The Default annotation is used to specify that all fields or methods should be serialized in a default manner. This basically allows an objects fields or properties to be serialized without the need to annotate them. This has advantages if the format of the serialized object is not important, as it allows the object to be serialized with a minimal use of annotations.
 
    @Root
    @Default(DefaultType.FIELD)
    public class Example {
       ...
    }
 
 
Defaults can be applied to either fields or property methods. If this annotation is applied to a class, certain fields or methods can be ignored using the Transient annotation. If a member is marked as transient then it will not be serialized. The defaults are applied only to those members that are not otherwise annotated with an XML annotation.
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    This is used to determine if the generated annotations are required or not.
    This method is used to return the type of default that is to be applied to the class.
  • Element Details

    • value

      This method is used to return the type of default that is to be applied to the class. Defaults can be applied to either fields or property methods. Any member with an XML annotation will not be treated as a default.
      Returns:
      this returns the type of defaults to be applied
      Default:
      FIELD
    • required

      boolean required
      This is used to determine if the generated annotations are required or not. By default generated parameters are required. Setting this to false means that null values are accepted by all defaulted fields or methods depending on the type.
      Returns:
      this is used to determine if defaults are required
      Default:
      true