Skip to content

Commit a5070d5

Browse files
committed
Correct ISO DateTime example
Issue: SPR-14675 (cherry picked from commit 68332bf)
1 parent 5fe608d commit a5070d5

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.format.annotation;
1818

19+
import java.lang.annotation.Documented;
1920
import java.lang.annotation.ElementType;
2021
import java.lang.annotation.Retention;
2122
import java.lang.annotation.RetentionPolicy;
@@ -28,19 +29,19 @@
2829
* Can be applied to {@code java.util.Date}, {@code java.util.Calendar}, {@code java.long.Long},
2930
* Joda-Time value types; and as of Spring 4 and JDK 8, to JSR-310 <code>java.time</code> types too.
3031
*
31-
* <p>For style-based formatting, set the {@link #style()} attribute to be the style pattern code.
32+
* <p>For style-based formatting, set the {@link #style} attribute to be the style pattern code.
3233
* The first character of the code is the date style, and the second character is the time style.
3334
* Specify a character of 'S' for short style, 'M' for medium, 'L' for long, and 'F' for full.
3435
* A date or time may be omitted by specifying the style character '-'.
3536
*
36-
* <p>For ISO-based formatting, set the {@link #iso()} attribute to be the desired {@link ISO} format,
37+
* <p>For ISO-based formatting, set the {@link #iso} attribute to be the desired {@link ISO} format,
3738
* such as {@link ISO#DATE}. For custom formatting, set the {@link #pattern()} attribute to be the
3839
* DateTime pattern, such as {@code yyyy/MM/dd hh:mm:ss a}.
3940
*
4041
* <p>Each attribute is mutually exclusive, so only set one attribute per annotation instance
4142
* (the one most convenient one for your formatting needs).
4243
* When the pattern attribute is specified, it takes precedence over both the style and ISO attribute.
43-
* When the iso attribute is specified, if takes precedence over the style attribute.
44+
* When the {@link #iso} attribute is specified, it takes precedence over the style attribute.
4445
* When no annotation attributes are specified, the default format applied is style-based
4546
* with a style code of 'SS' (short date, short time).
4647
*
@@ -49,8 +50,9 @@
4950
* @since 3.0
5051
* @see org.joda.time.format.DateTimeFormat
5152
*/
52-
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
53+
@Documented
5354
@Retention(RetentionPolicy.RUNTIME)
55+
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
5456
public @interface DateTimeFormat {
5557

5658
/**
@@ -80,23 +82,23 @@
8082
/**
8183
* Common ISO date time format patterns.
8284
*/
83-
public enum ISO {
85+
enum ISO {
8486

8587
/**
8688
* The most common ISO Date Format {@code yyyy-MM-dd},
87-
* e.g. 2000-10-31.
89+
* e.g. "2000-10-31".
8890
*/
8991
DATE,
9092

9193
/**
9294
* The most common ISO Time Format {@code HH:mm:ss.SSSZ},
93-
* e.g. 01:30:00.000-05:00.
95+
* e.g. "01:30:00.000-05:00".
9496
*/
9597
TIME,
9698

9799
/**
98100
* The most common ISO DateTime Format {@code yyyy-MM-dd'T'HH:mm:ss.SSSZ},
99-
* e.g. 2000-10-31 01:30:00.000-05:00.
101+
* e.g. "2000-10-31T01:30:00.000-05:00".
100102
* <p>This is the default if no annotation value is specified.
101103
*/
102104
DATE_TIME,

0 commit comments

Comments
 (0)