71 * Create a {@link StringConverter} for {@link LocalDate} values, using a
72 * default formatter and parser based on {@link IsoChronology},
73 * the specified {@link FormatStyle}, and the user's {@link Locale}.
74 *
75 * @param dateStyle The {@link FormatStyle} that will be used by the default
76 * formatter and parser. If null then {@link FormatStyle#SHORT} will be used.
77 */
78 public LocalDateStringConverter(FormatStyle dateStyle) {
79 ldtConverter = new LdtConverter<LocalDate>(LocalDate.class, null, null,
80 dateStyle, null, null, null);
81 }
82
83 /**
84 * Create a {#link StringConverter} for {@link LocalDate} values using the supplied
85 * formatter and parser.
86 *
87 * <p>For example, to use a fixed pattern for converting both ways:</p>
88 * <blockquote><pre>
89 * String pattern = "yyyy-MM-dd";
90 * DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
91 * StringConverter<LocalDate> converter =
92 * DateTimeStringConverter.getLocalDateStringConverter(formatter, null);
93 * </pre></blockquote>
94 *
95 * Note that the formatter and parser can be created to handle non-default
96 * {@link Locale} and {@link Chronology} as needed.
97 *
98 * @param formatter An instance of {@link DateTimeFormatter} that will be
99 * used for formatting by the toString() method. If null then a default
100 * formatter will be used.
101 * @param parser An instance of {@link DateTimeFormatter} that will be used
102 * for parsing by the fromString() method. This can be identical to
103 * formatter. If null then formatter will be used, and if that is also null,
104 * then a default parser will be used.
105 */
106 public LocalDateStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser) {
107 ldtConverter = new LdtConverter<LocalDate>(LocalDate.class, formatter, parser,
108 null, null, null, null);
109 }
110
111
|
71 * Create a {@link StringConverter} for {@link LocalDate} values, using a
72 * default formatter and parser based on {@link IsoChronology},
73 * the specified {@link FormatStyle}, and the user's {@link Locale}.
74 *
75 * @param dateStyle The {@link FormatStyle} that will be used by the default
76 * formatter and parser. If null then {@link FormatStyle#SHORT} will be used.
77 */
78 public LocalDateStringConverter(FormatStyle dateStyle) {
79 ldtConverter = new LdtConverter<LocalDate>(LocalDate.class, null, null,
80 dateStyle, null, null, null);
81 }
82
83 /**
84 * Create a {#link StringConverter} for {@link LocalDate} values using the supplied
85 * formatter and parser.
86 *
87 * <p>For example, to use a fixed pattern for converting both ways:</p>
88 * <blockquote><pre>
89 * String pattern = "yyyy-MM-dd";
90 * DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
91 * StringConverter<LocalDate> converter =
92 * DateTimeStringConverter.getLocalDateStringConverter(formatter, null);
93 * </pre></blockquote>
94 *
95 * Note that the formatter and parser can be created to handle non-default
96 * {@link Locale} and {@link Chronology} as needed.
97 *
98 * @param formatter An instance of {@link DateTimeFormatter} that will be
99 * used for formatting by the toString() method. If null then a default
100 * formatter will be used.
101 * @param parser An instance of {@link DateTimeFormatter} that will be used
102 * for parsing by the fromString() method. This can be identical to
103 * formatter. If null then formatter will be used, and if that is also null,
104 * then a default parser will be used.
105 */
106 public LocalDateStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser) {
107 ldtConverter = new LdtConverter<LocalDate>(LocalDate.class, formatter, parser,
108 null, null, null, null);
109 }
110
111
|