Annotation Type WizField
@Inherited @Target(FIELD) @Retention(RUNTIME) @Documented public @interface WizField
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:
Primitive
typesString
orNumber
classesenum
classesDate
,XMLGregorianCalendar
and their derivatives- A class that extends
DataObject
- A class that is annotated by or inherits the
WizSerializable
annotation - A class that is annotated by
XmlType
- A class that implements serialization methods
- Aggregates (array,
List
,Set
orMap
) of the above types (in case of a Map both the key and the value need to be 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 theformat
element ofWizField
annotation.Deserialization Methods Method Deserialization Type Class constructor with aString
argumentConverts from a string by the class constructorstatic <T> fromString(String val)
Converts from a string by a static methodstatic <T> parse(String val, String format)
Converts from a string using a format specifier. The format to use shall be specified by theformat
element ofWizField
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 aDate
orXMLGregorianCalendar
value across different time zones.int
precision
Specifies the precision to be used when serializing a float or double value.
-
Element Details
-
format
String formatA 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
orXMLGregorianCalendar
. If used, it specifies the pattern used for serialization as defined inSimpleDateFormat
. If not used, the patternddMMyyHHmmss
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 precisionSpecifies 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 ignoreZoneDifferenceSpecifies whether to ignore time zone differences when transferring aDate
orXMLGregorianCalendar
value across different time zones.By default when a
Date
orXMLGregorianCalendar
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 totrue
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
-