Annotation Type WizField


@Inherited
@Target(FIELD)
@Retention(RUNTIME)
@Documented
public @interface WizField
Identifies a serializable field of a serializable class.

Use this annotation to decorate member fields of a data object class (a class that extends DataObject) or a serializable class (a class that is annotated by or inherits WizSerializable annotation) that you want to be serialized and shared across the network.

A class field annotated as WizField must be serializable. Any of the following field types is serializable:

  • Serialization and Deserialization Methods

    Other than the classes mentioned above, a class is considered serializable if it implements a serialization method and a deserialization method. A serialization method is any of the following:
    Serialization Methods 
    Method Serialization Type
    String toString()
    Simple string conversion.
    String format(String format)
    String conversion using a format specifier. The format to use shall be specified by the format element of WizField annotation.

     

    Classes that implement a serialization method must also implement a deserialization method which is one of the following:
    Deserialization Methods 
    Method Deserialization Type
    Class constructor with a String argument
    Converts from a string by the class constructor
    static <T> fromString(String val)
    Converts from a string by a static method
    static <T> parse(String val, String format)
    Converts from a string using a format specifier. The format to use shall be specified by the format element of WizField annotation.
  • Optional Element Summary

    Optional Elements 
    Modifier and Type Optional Element Description
    String format
    A format string to be used when the annotated field is serialized.
    boolean ignoreZoneDifference
    Specifies whether to ignore time zone differences when transferring a Date or XMLGregorianCalendar value across different time zones.
    int precision
    Specifies the precision to be used when serializing a float or double value.
  • Element Details

    • format

      String format
      A format string to be used when the annotated field is serialized.

      This element is mandatory when the annotated field is serialized using the format() method. It specifies the format specifier that the method gets as its argument.

      The element is optional when the annotated field is of type Date or XMLGregorianCalendar. If used, it specifies the pattern used for serialization as defined in SimpleDateFormat. If not used, the pattern ddMMyyHHmmss will be used, which means that milliseconds are truncated to centiseconds.

      Returns:
      a format string or an empty string that indicates default serialization pattern.
      Default:
      ""
    • precision

      int precision
      Specifies the precision to be used when serializing a float or double value.

      The field value is interpreted as the number of digits after the decimal point to retain in the serialized string. A negative value indicates that the exact value shall be retained.

      Returns:
      the precision to be used when serializing a float or double value.
      Default:
      -1
    • ignoreZoneDifference

      boolean ignoreZoneDifference
      Specifies whether to ignore time zone differences when transferring a Date or XMLGregorianCalendar value across different time zones.

      By default when a Date or XMLGregorianCalendar value is serialized, the value is converted to GMT time so that the receiving node will convert it back to local time zone and get it right even if the peer nodes are deployed in different time zones. By setting this element to true you can instruct the serializer (and the deserializer) to ignore time zone differences and transfer the local time value without conversion.

      Returns:
      true if local time shall be transferred without conversion.
      Default:
      false