diff --git a/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java b/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java index a054dc86e3..5feb6ee8b0 100644 --- a/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java +++ b/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java @@ -82,23 +82,23 @@ public @interface DateTimeFormat { /** * Common ISO date time format patterns. */ - public enum ISO { + enum ISO { /** * The most common ISO Date Format {@code yyyy-MM-dd}, - * e.g. 2000-10-31. + * e.g. "2000-10-31". */ DATE, /** * The most common ISO Time Format {@code HH:mm:ss.SSSZ}, - * e.g. 01:30:00.000-05:00. + * e.g. "01:30:00.000-05:00". */ TIME, /** * The most common ISO DateTime Format {@code yyyy-MM-dd'T'HH:mm:ss.SSSZ}, - * e.g. 2000-10-31 01:30:00.000-05:00. + * e.g. "2000-10-31 01:30:00.000-05:00". *
This is the default if no annotation value is specified. */ DATE_TIME, 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 5e42d3b23a..d56c46cae9 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 @@ -70,11 +70,11 @@ public @interface NumberFormat { /** * Common number format styles. */ - public enum Style { + enum Style { /** - * The default format for the annotated type: typically number - * but possibly currency for a money type. + * The default format for the annotated type: typically 'number' but possibly + * 'currency' for a money type (e.g. {@code javax.money.MonetaryAmount)}. * @since 4.2 */ DEFAULT, @@ -85,14 +85,14 @@ public @interface NumberFormat { NUMBER, /** - * The currency format for the current locale. + * The percent format for the current locale. */ - CURRENCY, + PERCENT, /** - * The percent format for the current locale. + * The currency format for the current locale. */ - PERCENT + CURRENCY } } diff --git a/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java b/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java index 2f508a7a0b..837b2ec93d 100644 --- a/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java +++ b/spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java @@ -61,12 +61,12 @@ public class NumberFormatAnnotationFormatterFactory extends EmbeddedValueResolut } else { Style style = annotation.style(); - if (style == Style.PERCENT) { - return new PercentStyleFormatter(); - } - else if (style == Style.CURRENCY) { + if (style == Style.CURRENCY) { return new CurrencyStyleFormatter(); } + else if (style == Style.PERCENT) { + return new PercentStyleFormatter(); + } else { return new NumberStyleFormatter(); }