|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2013 the original author or authors. |
| 2 | + * Copyright 2002-2016 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
16 | 16 |
|
17 | 17 | package org.springframework.format.annotation;
|
18 | 18 |
|
| 19 | +import java.lang.annotation.Documented; |
19 | 20 | import java.lang.annotation.ElementType;
|
20 | 21 | import java.lang.annotation.Retention;
|
21 | 22 | import java.lang.annotation.RetentionPolicy;
|
|
28 | 29 | * Can be applied to {@code java.util.Date}, {@code java.util.Calendar}, {@code java.long.Long},
|
29 | 30 | * Joda-Time value types; and as of Spring 4 and JDK 8, to JSR-310 <code>java.time</code> types too.
|
30 | 31 | *
|
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. |
32 | 33 | * The first character of the code is the date style, and the second character is the time style.
|
33 | 34 | * Specify a character of 'S' for short style, 'M' for medium, 'L' for long, and 'F' for full.
|
34 | 35 | * A date or time may be omitted by specifying the style character '-'.
|
35 | 36 | *
|
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, |
37 | 38 | * such as {@link ISO#DATE}. For custom formatting, set the {@link #pattern()} attribute to be the
|
38 | 39 | * DateTime pattern, such as {@code yyyy/MM/dd hh:mm:ss a}.
|
39 | 40 | *
|
40 | 41 | * <p>Each attribute is mutually exclusive, so only set one attribute per annotation instance
|
41 | 42 | * (the one most convenient one for your formatting needs).
|
42 | 43 | * 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. |
44 | 45 | * When no annotation attributes are specified, the default format applied is style-based
|
45 | 46 | * with a style code of 'SS' (short date, short time).
|
46 | 47 | *
|
|
49 | 50 | * @since 3.0
|
50 | 51 | * @see org.joda.time.format.DateTimeFormat
|
51 | 52 | */
|
52 |
| -@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE}) |
| 53 | +@Documented |
53 | 54 | @Retention(RetentionPolicy.RUNTIME)
|
| 55 | +@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE}) |
54 | 56 | public @interface DateTimeFormat {
|
55 | 57 |
|
56 | 58 | /**
|
|
80 | 82 | /**
|
81 | 83 | * Common ISO date time format patterns.
|
82 | 84 | */
|
83 |
| - public enum ISO { |
| 85 | + enum ISO { |
84 | 86 |
|
85 | 87 | /**
|
86 | 88 | * The most common ISO Date Format {@code yyyy-MM-dd},
|
87 |
| - * e.g. 2000-10-31. |
| 89 | + * e.g. "2000-10-31". |
88 | 90 | */
|
89 | 91 | DATE,
|
90 | 92 |
|
91 | 93 | /**
|
92 | 94 | * 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". |
94 | 96 | */
|
95 | 97 | TIME,
|
96 | 98 |
|
97 | 99 | /**
|
98 | 100 | * 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". |
100 | 102 | * <p>This is the default if no annotation value is specified.
|
101 | 103 | */
|
102 | 104 | DATE_TIME,
|
|
0 commit comments