Annotation Interface NumberFormat
Supports formatting by style or custom pattern string. Can be applied to
any JDK Number types such as Double and Long.
For style-based formatting, set the style() attribute to the desired
NumberFormat.Style. For custom formatting, set the pattern() attribute to the
desired number pattern, such as "#,###.##".
Each attribute is mutually exclusive, so only set one attribute per
annotation (the one most convenient for your formatting needs). When the
pattern() attribute is specified, it takes precedence over the
style() attribute. When no annotation attributes are specified, the
default format applied is style-based for either number or currency,
depending on the annotated field or method parameter type.
- Since:
- 3.0
- Author:
- Keith Donald, Juergen Hoeller
- See Also:
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe custom pattern to use to format the field or method parameter.The style pattern to use to format the field or method parameter.
-
Element Details
-
style
NumberFormat.Style styleThe style pattern to use to format the field or method parameter.Defaults to
NumberFormat.Style.DEFAULTfor general-purpose number formatting for most annotated types, except for money types which default to currency formatting.Set this attribute when you wish to format your field or method parameter in accordance with a common style other than the default style.
- Default:
- DEFAULT
-
pattern
String patternThe custom pattern to use to format the field or method parameter.Defaults to an empty String, indicating no custom pattern has been specified.
Set this attribute when you wish to format your field or method parameter in accordance with a custom number pattern not represented by a style.
- Default:
- ""
-