Skip to content

Commit ae804cb

Browse files
committed
Improve @⁠NumberFormat Javadoc
See gh-35742
1 parent 46503d6 commit ae804cb

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525
/**
2626
* Declares that a field or method parameter should be formatted as a number.
2727
*
28-
* <p>Supports formatting by style or custom pattern string. Can be applied
29-
* to any JDK {@code Number} type such as {@code Double} and {@code Long}.
28+
* <p>Supports formatting by style or custom pattern string. Can be applied to
29+
* any JDK {@code Number} types such as {@code Double} and {@code Long}.
3030
*
31-
* <p>For style-based formatting, set the {@link #style} attribute to be the
32-
* desired {@link Style}. For custom formatting, set the {@link #pattern}
33-
* attribute to be the number pattern, such as {@code #, ###.##}.
31+
* <p>For style-based formatting, set the {@link #style} attribute to the desired
32+
* {@link Style}. For custom formatting, set the {@link #pattern} attribute to the
33+
* desired number pattern, such as {@code "#,###.##"}.
3434
*
3535
* <p>Each attribute is mutually exclusive, so only set one attribute per
36-
* annotation instance (the one most convenient one for your formatting needs).
37-
* When the {@link #pattern} attribute is specified, it takes precedence over
38-
* the {@link #style} attribute. When no annotation attributes are specified,
39-
* the default format applied is style-based for either number or currency,
36+
* annotation (the one most convenient for your formatting needs). When the
37+
* {@link #pattern} attribute is specified, it takes precedence over the
38+
* {@link #style} attribute. When no annotation attributes are specified, the
39+
* default format applied is style-based for either number or currency,
4040
* depending on the annotated field or method parameter type.
4141
*
4242
* @author Keith Donald
@@ -50,19 +50,21 @@
5050
public @interface NumberFormat {
5151

5252
/**
53-
* The style pattern to use to format the field.
53+
* The style pattern to use to format the field or method parameter.
5454
* <p>Defaults to {@link Style#DEFAULT} for general-purpose number formatting
5555
* for most annotated types, except for money types which default to currency
56-
* formatting. Set this attribute when you wish to format your field in
57-
* accordance with a common style other than the default style.
56+
* formatting.
57+
* <p>Set this attribute when you wish to format your field or method parameter
58+
* in accordance with a common style other than the default style.
5859
*/
5960
Style style() default Style.DEFAULT;
6061

6162
/**
62-
* The custom pattern to use to format the field.
63-
* <p>Defaults to empty String, indicating no custom pattern String has been specified.
64-
* Set this attribute when you wish to format your field in accordance with a
65-
* custom number pattern not represented by a style.
63+
* The custom pattern to use to format the field or method parameter.
64+
* <p>Defaults to an empty String, indicating no custom pattern has been
65+
* specified.
66+
* <p>Set this attribute when you wish to format your field or method parameter
67+
* in accordance with a custom number pattern not represented by a style.
6668
*/
6769
String pattern() default "";
6870

0 commit comments

Comments
 (0)