接口的使用
org.springframework.format.Formatter
使用Formatter的程序包 程序包 说明 org.springframework.format An API for defining Formatters to format field model values for display in a UI.org.springframework.format.datetime Formatters forjava.util.Date
properties.org.springframework.format.datetime.standard Integration with the JSR-310java.time
package in JDK 8.org.springframework.format.number Formatters forjava.lang.Number
properties.org.springframework.format.number.money Integration with the JSR-354javax.money
package.org.springframework.format.support Support classes for the formatting package, providing common implementations as well as adapters.org.springframework.validation Provides data binding and validation functionality, for usage in business and/or UI layers.org.springframework.format中Formatter的使用
参数类型为Formatter的org.springframework.format中的方法 修饰符和类型 方法 说明 void
FormatterRegistry. addFormatter(Formatter<?> formatter)
Adds a Formatter to format fields of a specific type.void
FormatterRegistry. addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter)
Adds a Formatter to format fields of the given type.org.springframework.format.datetime中Formatter的使用
实现Formatter的org.springframework.format.datetime中的类 修饰符和类型 类 说明 class
DateFormatter
A formatter forDate
types.返回Formatter的org.springframework.format.datetime中的方法 修饰符和类型 方法 说明 protected Formatter<Date>
DateTimeFormatAnnotationFormatterFactory. getFormatter(DateTimeFormat annotation, Class<?> fieldType)
org.springframework.format.datetime.standard中Formatter的使用
实现Formatter的org.springframework.format.datetime.standard中的类 修饰符和类型 类 说明 class
InstantFormatter
Formatter
implementation for a JSR-310Instant
, following JSR-310's parsing rules for an Instant (that is, not using a configurableDateTimeFormatter
): accepting the defaultISO_INSTANT
format as well asRFC_1123_DATE_TIME
(which is commonly used for HTTP date header values), as of Spring 4.3.org.springframework.format.number中Formatter的使用
实现Formatter的org.springframework.format.number中的类 修饰符和类型 类 说明 class
AbstractNumberFormatter
Abstract formatter for Numbers, providing aAbstractNumberFormatter.getNumberFormat(java.util.Locale)
template method.class
CurrencyStyleFormatter
A BigDecimal formatter for number values in currency style.class
NumberStyleFormatter
A general-purpose number formatter using NumberFormat's number style.class
PercentStyleFormatter
A formatter for number values in percent style.org.springframework.format.number.money中Formatter的使用
实现Formatter的org.springframework.format.number.money中的类 修饰符和类型 类 说明 class
CurrencyUnitFormatter
Formatter for JSR-354CurrencyUnit
values, from and to currency code Strings.class
MonetaryAmountFormatter
Formatter for JSR-354MonetaryAmount
values, delegating toMonetaryAmountFormat.format(javax.money.MonetaryAmount)
andMonetaryAmountFormat.parse(java.lang.CharSequence)
.org.springframework.format.support中Formatter的使用
参数类型为Formatter的org.springframework.format.support中的方法 修饰符和类型 方法 说明 void
FormattingConversionService. addFormatter(Formatter<?> formatter)
void
FormattingConversionService. addFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter)
参数类型为Formatter的org.springframework.format.support中的构造器 构造器 说明 FormatterPropertyEditorAdapter(Formatter<?> formatter)
Create a newFormatterPropertyEditorAdapter
for the givenFormatter
.org.springframework.validation中Formatter的使用
参数类型为Formatter的org.springframework.validation中的方法 修饰符和类型 方法 说明 void
DataBinder. addCustomFormatter(Formatter<?> formatter)
Add a custom formatter, applying it to all fields matching theFormatter
-declared type.void
DataBinder. addCustomFormatter(Formatter<?> formatter, Class<?>... fieldTypes)
Add a custom formatter, applying it to the specified field types only, if any, or otherwise to all fields matching theFormatter
-declared type.void
DataBinder. addCustomFormatter(Formatter<?> formatter, String... fields)
Add a custom formatter for the field type specified inFormatter
class, applying it to the specified fields only, if any, or otherwise to all fields.