Browse Source

Polishing

pull/814/head
Juergen Hoeller 10 years ago
parent
commit
271804f105
  1. 8
      spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java
  2. 14
      spring-context/src/main/java/org/springframework/format/annotation/NumberFormat.java
  3. 8
      spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java

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

@ -82,23 +82,23 @@ public @interface DateTimeFormat { @@ -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".
* <p>This is the default if no annotation value is specified.
*/
DATE_TIME,

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

@ -70,11 +70,11 @@ public @interface NumberFormat { @@ -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 { @@ -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
}
}

8
spring-context/src/main/java/org/springframework/format/number/NumberFormatAnnotationFormatterFactory.java

@ -61,12 +61,12 @@ public class NumberFormatAnnotationFormatterFactory extends EmbeddedValueResolut @@ -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();
}

Loading…
Cancel
Save