public class DateTimeFormatterFactory
extends java.lang.Object
DateTimeFormatter
. Formatters will be
created using the defined pattern
, ISO
,
or style
(considered in that order).createDateTimeFormatter()
,
createDateTimeFormatter(DateTimeFormatter)
,
setPattern(String)
,
setIso(org.springframework.format.annotation.DateTimeFormat.ISO)
,
setStyle(String)
,
DateTimeFormatterFactoryBean
Modifier and Type | Field and Description |
---|---|
private DateTimeFormat.ISO |
iso |
private java.lang.String |
pattern |
private java.lang.String |
style |
private java.util.TimeZone |
timeZone |
Constructor and Description |
---|
DateTimeFormatterFactory()
Create a new
DateTimeFormatterFactory instance. |
DateTimeFormatterFactory(java.lang.String pattern)
Create a new
DateTimeFormatterFactory instance. |
Modifier and Type | Method and Description |
---|---|
DateTimeFormatter |
createDateTimeFormatter()
Create a new
DateTimeFormatter using this factory. |
DateTimeFormatter |
createDateTimeFormatter(DateTimeFormatter fallbackFormatter)
Create a new
DateTimeFormatter using this factory. |
void |
setIso(DateTimeFormat.ISO iso)
Set the ISO format used to format date values.
|
void |
setPattern(java.lang.String pattern)
Set the pattern to use to format date values.
|
void |
setStyle(java.lang.String style)
Set the two characters to use to format date values.
|
void |
setTimeZone(java.util.TimeZone timeZone)
Set the
TimeZone to normalize the date values into, if any. |
private DateTimeFormat.ISO iso
private java.lang.String style
private java.lang.String pattern
private java.util.TimeZone timeZone
public DateTimeFormatterFactory()
DateTimeFormatterFactory
instance.public DateTimeFormatterFactory(java.lang.String pattern)
DateTimeFormatterFactory
instance.pattern
- the pattern to use to format date valuespublic DateTimeFormatter createDateTimeFormatter()
DateTimeFormatter
using this factory. If no specific
style
, ISO
, or
pattern
have been defined the
medium date time format
will be used.createDateTimeFormatter(DateTimeFormatter)
public DateTimeFormatter createDateTimeFormatter(DateTimeFormatter fallbackFormatter)
DateTimeFormatter
using this factory. If no specific
style
, ISO
, or
pattern
have been defined the supplied
fallbackFormatter
will be used.fallbackFormatter
- the fall-back formatter to use when no specific factory
properties have been set (can be null
).public void setTimeZone(java.util.TimeZone timeZone)
TimeZone
to normalize the date values into, if any.timeZone
- the time zonepublic void setStyle(java.lang.String style)
This method mimics the styles supported by Joda Time.
style
- two characters from the set {"S", "M", "L", "F", "-"}public void setIso(DateTimeFormat.ISO iso)
iso
- the ISO formatpublic void setPattern(java.lang.String pattern)
pattern
- the format pattern