|
1 | 1 | /* |
2 | | - * Copyright 2002-2012 the original author or authors. |
| 2 | + * Copyright 2002-2013 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. |
|
23 | 23 |
|
24 | 24 | /** |
25 | 25 | * Declares that a field should be formatted as a date time. |
26 | | - * Supports formatting by style pattern, ISO date time pattern, or custom format pattern string. |
27 | | - * Can be applied to {@code java.util.Date}, {@code java.util.Calendar}, {@code java.long.Long}, or Joda Time fields. |
28 | | - * <p> |
29 | | - * For style-based formatting, set the {@link #style()} attribute to be the style pattern code. |
| 26 | + * |
| 27 | + * <p>Supports formatting by style pattern, ISO date time pattern, or custom format pattern string. |
| 28 | + * Can be applied to {@code java.util.Date}, {@code java.util.Calendar}, {@code java.long.Long}, |
| 29 | + * Joda-Time value types; and as of Spring 4 and JDK 8, to JSR-310 <code>java.time</code> types too. |
| 30 | + * |
| 31 | + * <p>For style-based formatting, set the {@link #style()} attribute to be the style pattern code. |
30 | 32 | * The first character of the code is the date style, and the second character is the time style. |
31 | 33 | * Specify a character of 'S' for short style, 'M' for medium, 'L' for long, and 'F' for full. |
32 | 34 | * A date or time may be omitted by specifying the style character '-'. |
33 | | - * <p> |
34 | | - * For ISO-based formatting, set the {@link #iso()} attribute to be the desired {@link ISO} format, such as {@link ISO#DATE}. |
35 | | - <p> |
36 | | - * For custom formatting, set the {@link #pattern()} attribute to be the DateTime pattern, such as {@code yyyy/MM/dd hh:mm:ss a}. |
37 | | - * <p> |
38 | | - * Each attribute is mutually exclusive, so only set one attribute per annotation instance (the one most convenient one for your formatting needs). |
| 35 | + * |
| 36 | + * <p>For ISO-based formatting, set the {@link #iso()} attribute to be the desired {@link ISO} format, |
| 37 | + * such as {@link ISO#DATE}. For custom formatting, set the {@link #pattern()} attribute to be the |
| 38 | + * DateTime pattern, such as {@code yyyy/MM/dd hh:mm:ss a}. |
| 39 | + * |
| 40 | + * <p>Each attribute is mutually exclusive, so only set one attribute per annotation instance |
| 41 | + * (the one most convenient one for your formatting needs). |
39 | 42 | * When the pattern attribute is specified, it takes precedence over both the style and ISO attribute. |
40 | 43 | * When the iso attribute is specified, if takes precedence over the style attribute. |
41 | | - * When no annotation attributes are specified, the default format applied is style-based with a style code of 'SS' (short date, short time). |
| 44 | + * When no annotation attributes are specified, the default format applied is style-based |
| 45 | + * with a style code of 'SS' (short date, short time). |
42 | 46 | * |
43 | 47 | * @author Keith Donald |
44 | 48 | * @author Juergen Hoeller |
|
51 | 55 |
|
52 | 56 | /** |
53 | 57 | * The style pattern to use to format the field. |
54 | | - * Defaults to 'SS' for short date time. |
55 | | - * Set this attribute when you wish to format your field in accordance with a common style other than the default style. |
| 58 | + * <p>Defaults to 'SS' for short date time. Set this attribute when you wish to format |
| 59 | + * your field in accordance with a common style other than the default style. |
56 | 60 | */ |
57 | 61 | String style() default "SS"; |
58 | 62 |
|
59 | 63 | /** |
60 | 64 | * The ISO pattern to use to format the field. |
61 | 65 | * The possible ISO patterns are defined in the {@link ISO} enum. |
62 | | - * Defaults to ISO.NONE, indicating this attribute should be ignored. |
63 | | - * Set this attribute when you wish to format your field in accordance with an ISO date time format. |
| 66 | + * <p>Defaults to {@link ISO#NONE}, indicating this attribute should be ignored. |
| 67 | + * Set this attribute when you wish to format your field in accordance with an ISO format. |
64 | 68 | */ |
65 | 69 | ISO iso() default ISO.NONE; |
66 | 70 |
|
67 | 71 | /** |
68 | 72 | * The custom pattern to use to format the field. |
69 | | - * Defaults to empty String, indicating no custom pattern String has been specified. |
70 | | - * Set this attribute when you wish to format your field in accordance with a custom date time pattern not represented by a style or ISO format. |
| 73 | + * <p>Defaults to empty String, indicating no custom pattern String has been specified. |
| 74 | + * Set this attribute when you wish to format your field in accordance with a custom |
| 75 | + * date time pattern not represented by a style or ISO format. |
71 | 76 | */ |
72 | 77 | String pattern() default ""; |
73 | 78 |
|
|
78 | 83 | public enum ISO { |
79 | 84 |
|
80 | 85 | /** |
81 | | - * The most common ISO Date Format {@code yyyy-MM-dd} e.g. 2000-10-31. |
| 86 | + * The most common ISO Date Format {@code yyyy-MM-dd}, |
| 87 | + * e.g. 2000-10-31. |
82 | 88 | */ |
83 | 89 | DATE, |
84 | 90 |
|
85 | 91 | /** |
86 | | - * The most common ISO Time Format {@code HH:mm:ss.SSSZ} e.g. 01:30:00.000-05:00. |
| 92 | + * The most common ISO Time Format {@code HH:mm:ss.SSSZ}, |
| 93 | + * e.g. 01:30:00.000-05:00. |
87 | 94 | */ |
88 | 95 | TIME, |
89 | 96 |
|
90 | 97 | /** |
91 | | - * 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. |
92 | | - * The default if no annotation value is specified. |
| 98 | + * 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. |
| 100 | + * <p>This is the default if no annotation value is specified. |
93 | 101 | */ |
94 | 102 | DATE_TIME, |
95 | 103 |
|
|
0 commit comments