diff --git a/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java b/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java index 299cc671716..78e0d733876 100644 --- a/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java +++ b/spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java @@ -25,18 +25,18 @@ import java.lang.annotation.Target; /** * Declares that a field or method parameter should be formatted as a number. * - *

Supports formatting by style or custom pattern string. Can be applied - * to any JDK {@code Number} type such as {@code Double} and {@code Long}. + *

Supports formatting by style or custom pattern string. Can be applied to + * any JDK {@code Number} types such as {@code Double} and {@code Long}. * - *

For style-based formatting, set the {@link #style} attribute to be the - * desired {@link Style}. For custom formatting, set the {@link #pattern} - * attribute to be the number pattern, such as {@code #, ###.##}. + *

For style-based formatting, set the {@link #style} attribute to the desired + * {@link Style}. For custom formatting, set the {@link #pattern} attribute to the + * desired number pattern, such as {@code "#,###.##"}. * *

Each attribute is mutually exclusive, so only set one attribute per - * annotation instance (the one most convenient one for your formatting needs). - * When the {@link #pattern} attribute is specified, it takes precedence over - * the {@link #style} attribute. When no annotation attributes are specified, - * the default format applied is style-based for either number or currency, + * annotation (the one most convenient for your formatting needs). When the + * {@link #pattern} attribute is specified, it takes precedence over the + * {@link #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. * * @author Keith Donald @@ -50,19 +50,21 @@ import java.lang.annotation.Target; public @interface NumberFormat { /** - * The style pattern to use to format the field. + * The style pattern to use to format the field or method parameter. *

Defaults to {@link Style#DEFAULT} for 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 in - * accordance with a common style other than the default style. + * 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. */ Style style() default Style.DEFAULT; /** - * 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. + * The 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. */ String pattern() default "";