类 DateTimeFormatterRegistrar
- java.lang.Object
- org.springframework.format.datetime.standard.DateTimeFormatterRegistrar
- 所有已实现的接口:
FormatterRegistrar
public class DateTimeFormatterRegistrar extends Object implements FormatterRegistrar
Configures the JSR-310java.time
formatting system for use with Spring.- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Phillip Webb
- 另请参阅:
setDateStyle(java.time.format.FormatStyle)
,setTimeStyle(java.time.format.FormatStyle)
,setDateTimeStyle(java.time.format.FormatStyle)
,setUseIsoFormat(boolean)
,FormatterRegistrar.registerFormatters(org.springframework.format.FormatterRegistry)
,DateFormatterRegistrar
,DateTimeFormatterFactoryBean
构造器概要
构造器 构造器 说明 DateTimeFormatterRegistrar()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
registerFormatters(FormatterRegistry registry)
Register Formatters and Converters with a FormattingConversionService through a FormatterRegistry SPI.void
setDateFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date values.void
setDateStyle(FormatStyle dateStyle)
Set the default format style ofLocalDate
objects.void
setDateTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date and time values.void
setDateTimeStyle(FormatStyle dateTimeStyle)
Set the default format style ofLocalDateTime
objects.void
setTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing time values.void
setTimeStyle(FormatStyle timeStyle)
Set the default format style ofLocalTime
objects.void
setUseIsoFormat(boolean useIsoFormat)
Set whether standard ISO formatting should be applied to all date/time types.
构造器详细资料
DateTimeFormatterRegistrar
public DateTimeFormatterRegistrar()
方法详细资料
setUseIsoFormat
public void setUseIsoFormat(boolean useIsoFormat)
Set whether standard ISO formatting should be applied to all date/time types. Default is "false" (no).If set to "true", the "dateStyle", "timeStyle" and "dateTimeStyle" properties are effectively ignored.
setDateStyle
public void setDateStyle(FormatStyle dateStyle)
Set the default format style ofLocalDate
objects. Default isFormatStyle.SHORT
.
setTimeStyle
public void setTimeStyle(FormatStyle timeStyle)
Set the default format style ofLocalTime
objects. Default isFormatStyle.SHORT
.
setDateTimeStyle
public void setDateTimeStyle(FormatStyle dateTimeStyle)
Set the default format style ofLocalDateTime
objects. Default isFormatStyle.SHORT
.
setDateFormatter
public void setDateFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date values.This formatter will be used for the
LocalDate
type. When specified, thedateStyle
anduseIsoFormat
properties will be ignored.- 参数:
formatter
- the formatter to use- 另请参阅:
setTimeFormatter(java.time.format.DateTimeFormatter)
,setDateTimeFormatter(java.time.format.DateTimeFormatter)
setTimeFormatter
public void setTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing time values.This formatter will be used for the
LocalTime
andOffsetTime
types. When specified, thetimeStyle
anduseIsoFormat
properties will be ignored.- 参数:
formatter
- the formatter to use- 另请参阅:
setDateFormatter(java.time.format.DateTimeFormatter)
,setDateTimeFormatter(java.time.format.DateTimeFormatter)
setDateTimeFormatter
public void setDateTimeFormatter(DateTimeFormatter formatter)
Set the formatter that will be used for objects representing date and time values.This formatter will be used for
LocalDateTime
,ZonedDateTime
andOffsetDateTime
types. When specified, thedateTimeStyle
anduseIsoFormat
properties will be ignored.- 参数:
formatter
- the formatter to use- 另请参阅:
setDateFormatter(java.time.format.DateTimeFormatter)
,setTimeFormatter(java.time.format.DateTimeFormatter)
registerFormatters
public void registerFormatters(FormatterRegistry registry)
从接口复制的说明:FormatterRegistrar
Register Formatters and Converters with a FormattingConversionService through a FormatterRegistry SPI.- 指定者:
registerFormatters
在接口中FormatterRegistrar
- 参数:
registry
- the FormatterRegistry instance to use.