Top Description Fields Constructors Methods
org.springframework.format.datetime.standard

public Class Jsr310DateTimeFormatAnnotationFormatterFactory

extends EmbeddedValueResolutionSupport
implements AnnotationFormatterFactory<DateTimeFormat>
Class Inheritance
All Implemented Interfaces
org.springframework.format.AnnotationFormatterFactory
Imports
java.time.Instant, .LocalDate, .LocalDateTime, .LocalTime, .MonthDay, .OffsetDateTime, .OffsetTime, .YearMonth, .ZonedDateTime, java.time.format.DateTimeFormatter, java.time.temporal.TemporalAccessor, java.util.ArrayList, .List, .Set, org.springframework.context.support.EmbeddedValueResolutionSupport, org.springframework.format.AnnotationFormatterFactory, .Parser, .Printer, org.springframework.format.annotation.DateTimeFormat, org.springframework.util.StringUtils

Formats fields annotated with the DateTimeFormat annotation using the JSR-310 java.time package in JDK 8.
Authors
Juergen Hoeller, Sam Brannen, Kazuki Shimizu
Since
4.0
See Also
org.springframework.format.annotation.DateTimeFormat

Field Summary

Modifier and TypeField and Description
private static final Set<Class<?>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final Set<Class<?>>
getFieldTypes()

Implements org.springframework.format.AnnotationFormatterFactory.getFieldTypes.

The types of fields that may be annotated with the <A> annotation.

protected DateTimeFormatter

Returns:

a DateTimeFormatter instance
getFormatter
(DateTimeFormat
the format annotation for the field
annotation
,
Class<?>
the declared type of the field
fieldType
)

Factory method used to create a DateTimeFormatter.

public Parser<?>
getParser(DateTimeFormat
the annotation instance
annotation
,
Class<?>
the type of field that was annotated
fieldType
)

Implements org.springframework.format.AnnotationFormatterFactory.getParser.

Get the Parser to parse a submitted value for a field of fieldType annotated with annotation.

public Printer<?>
getPrinter(DateTimeFormat
the annotation instance
annotation
,
Class<?>
the type of field that was annotated
fieldType
)

Implements org.springframework.format.AnnotationFormatterFactory.getPrinter.

Get the Printer to print the value of a field of fieldType annotated with annotation.

private boolean
isLocal(Class<?> fieldType)

Inherited from org.springframework.context.support.EmbeddedValueResolutionSupport:
resolveEmbeddedValuesetEmbeddedValueResolver

Field Detail

FIELD_TYPESback to summary
private static final Set<Class<?>> FIELD_TYPES

Constructor Detail

Jsr310DateTimeFormatAnnotationFormatterFactoryback to summary
public Jsr310DateTimeFormatAnnotationFormatterFactory()

Method Detail

getFieldTypesback to summary
public final Set<Class<?>> getFieldTypes()

Implements org.springframework.format.AnnotationFormatterFactory.getFieldTypes.

Doc from org.springframework.format.AnnotationFormatterFactory.getFieldTypes.

The types of fields that may be annotated with the <A> annotation.

Annotations
@Override
getFormatterback to summary
protected DateTimeFormatter getFormatter(DateTimeFormat annotation, Class<?> fieldType)

Factory method used to create a DateTimeFormatter.

Parameters
annotation:DateTimeFormat

the format annotation for the field

fieldType:Class<?>

the declared type of the field

Returns:DateTimeFormatter

a DateTimeFormatter instance

getParserback to summary
public Parser<?> getParser(DateTimeFormat annotation, Class<?> fieldType)

Implements org.springframework.format.AnnotationFormatterFactory.getParser.

Doc from org.springframework.format.AnnotationFormatterFactory.getParser.

Get the Parser to parse a submitted value for a field of fieldType annotated with annotation.

If the object the parser returns is not assignable to fieldType, a coercion to fieldType will be attempted before the field is set.

Parameters
annotation:DateTimeFormat

the annotation instance

fieldType:Class<?>

the type of field that was annotated

Returns:Parser<?>

the parser

Annotations
@Override
@SuppressWarnings:unchecked
getPrinterback to summary
public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType)

Implements org.springframework.format.AnnotationFormatterFactory.getPrinter.

Doc from org.springframework.format.AnnotationFormatterFactory.getPrinter.

Get the Printer to print the value of a field of fieldType annotated with annotation.

If the type T the printer accepts is not assignable to fieldType, a coercion from fieldType to T will be attempted before the Printer is invoked.

Parameters
annotation:DateTimeFormat

the annotation instance

fieldType:Class<?>

the type of field that was annotated

Returns:Printer<?>

the printer

Annotations
@Override
isLocalback to summary
private boolean isLocal(Class<?> fieldType)