Supports formatting by style or custom pattern string. Can be applied
to any JDK Number type such as Double and Long.
For style-based formatting, set the style attribute to be the
desired Style. For custom formatting, set the pattern
attribute to be the number pattern, such as #, ###.##.
Each attribute is mutually exclusive, so only set one attribute per
annotation instance (the one most convenient one 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 of currency,
depending on the annotated field or method parameter type.
java.text.NumberFormat
| Modifier and Type | Class and Description |
|---|---|
| public static enum | NumberFormat.Style
Common number format styles. |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public NumberFormat. |
| pattern | back to summary |
|---|---|
| public String pattern() The custom pattern to use to format the field. Defaults to empty String, indicating no custom pattern String has been specified. Set this attribute when you wish to format your field in accordance with a custom number pattern not represented by a style. | |
| style | back to summary |
|---|---|
| public NumberFormat. The style pattern to use to format the field. Defaults to | |
| Modifier and Type | Field and Description |
|---|---|
| public static final NumberFormat. | CURRENCY
The currency format for the current locale. |
| public static final NumberFormat. | DEFAULT
The default format for the annotated type: typically 'number' but possibly
'currency' for a money type (e.g. |
| public static final NumberFormat. | NUMBER
The general-purpose number format for the current locale. |
| public static final NumberFormat. | PERCENT
The percent format for the current locale. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static NumberFormat. | |
| public static NumberFormat. |
| CURRENCY | back to summary |
|---|---|
| public static final NumberFormat. The currency format for the current locale. | |
| DEFAULT | back to summary |
|---|---|
| public static final NumberFormat. The default format for the annotated type: typically 'number' but possibly
'currency' for a money type (e.g.
| |
| NUMBER | back to summary |
|---|---|
| public static final NumberFormat. The general-purpose number format for the current locale. | |
| PERCENT | back to summary |
|---|---|
| public static final NumberFormat. The percent format for the current locale. | |
| Style | back to summary |
|---|---|
| private Style() | |
| valueOf | back to summary |
|---|---|
| public static NumberFormat. | |
| values | back to summary |
|---|---|
| public static NumberFormat. | |