Class FormattingConversionService
java.lang.Object
org.springframework.core.convert.support.GenericConversionService
org.springframework.format.support.FormattingConversionService
- All Implemented Interfaces:
- Aware, EmbeddedValueResolverAware, ConversionService, ConverterRegistry, ConfigurableConversionService, FormatterRegistry
- Direct Known Subclasses:
- DefaultFormattingConversionService
public class FormattingConversionService
extends GenericConversionService
implements FormatterRegistry, EmbeddedValueResolverAware
A 
ConversionService implementation
designed to be configured as a FormatterRegistry.- Since:
- 3.0
- Author:
- Keith Donald, Juergen Hoeller
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddFormatter(Formatter<?> formatter) Adds a Formatter to format fields of a specific type.voidaddFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory) Adds a Formatter to format fields annotated with a specific format annotation.voidaddFormatterForFieldType(Class<?> fieldType, Formatter<?> formatter) Adds a Formatter to format fields of the given type.voidaddFormatterForFieldType(Class<?> fieldType, Printer<?> printer, Parser<?> parser) Adds a Printer/Parser pair to format fields of a specific type.voidAdds a Parser to parse fields of a specific type.voidaddPrinter(Printer<?> printer) Adds a Printer to print fields of a specific type.voidsetEmbeddedValueResolver(StringValueResolver resolver) Set the StringValueResolver to use for resolving embedded definition values.Methods inherited from class GenericConversionServiceaddConverter, addConverter, addConverter, addConverterFactory, canBypassConvert, canConvert, canConvert, convert, convert, convertNullSource, getConverter, getDefaultConverter, removeConvertible, toStringMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ConversionServiceconvertMethods inherited from interface ConverterRegistryaddConverter, addConverter, addConverter, addConverterFactory, removeConvertible
- 
Constructor Details- 
FormattingConversionServicepublic FormattingConversionService()
 
- 
- 
Method Details- 
setEmbeddedValueResolverDescription copied from interface:EmbeddedValueResolverAwareSet the StringValueResolver to use for resolving embedded definition values.- Specified by:
- setEmbeddedValueResolverin interface- EmbeddedValueResolverAware
 
- 
addPrinterDescription copied from interface:FormatterRegistryAdds a Printer to print fields of a specific type. The field type is implied by the parameterized Printer instance.- Specified by:
- addPrinterin interface- FormatterRegistry
- Parameters:
- printer- the printer to add
- See Also:
 
- 
addParserDescription copied from interface:FormatterRegistryAdds a Parser to parse fields of a specific type. The field type is implied by the parameterized Parser instance.- Specified by:
- addParserin interface- FormatterRegistry
- Parameters:
- parser- the parser to add
- See Also:
 
- 
addFormatterDescription copied from interface:FormatterRegistryAdds a Formatter to format fields of a specific type. The field type is implied by the parameterized Formatter instance.- Specified by:
- addFormatterin interface- FormatterRegistry
- Parameters:
- formatter- the formatter to add
- See Also:
 
- 
addFormatterForFieldTypeDescription copied from interface:FormatterRegistryAdds a Formatter to format fields of the given type.On print, if the Formatter's type T is declared and fieldTypeis not assignable to T, a coercion to T will be attempted before delegating toformatterto print a field value. On parse, if the parsed object returned byformatteris not assignable to the runtime field type, a coercion to the field type will be attempted before returning the parsed field value.- Specified by:
- addFormatterForFieldTypein interface- FormatterRegistry
- Parameters:
- fieldType- the field type to format
- formatter- the formatter to add
 
- 
addFormatterForFieldTypeDescription copied from interface:FormatterRegistryAdds a Printer/Parser pair to format fields of a specific type. The formatter will delegate to the specifiedprinterfor printing and the specifiedparserfor parsing.On print, if the Printer's type T is declared and fieldTypeis not assignable to T, a coercion to T will be attempted before delegating toprinterto print a field value. On parse, if the object returned by the Parser is not assignable to the runtime field type, a coercion to the field type will be attempted before returning the parsed field value.- Specified by:
- addFormatterForFieldTypein interface- FormatterRegistry
- Parameters:
- fieldType- the field type to format
- printer- the printing part of the formatter
- parser- the parsing part of the formatter
 
- 
addFormatterForFieldAnnotationpublic void addFormatterForFieldAnnotation(AnnotationFormatterFactory<? extends Annotation> annotationFormatterFactory) Description copied from interface:FormatterRegistryAdds a Formatter to format fields annotated with a specific format annotation.- Specified by:
- addFormatterForFieldAnnotationin interface- FormatterRegistry
- Parameters:
- annotationFormatterFactory- the annotation formatter factory to add
 
 
-