|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.core.convert.support.ObjectToStringConverter
final class ObjectToStringConverter
Simply calls Object.toString()
to convert any supported Object to a String.
Supports Number, Boolean, Character, CharSequence, StringWriter, any enum,
and any class with a String constructor or valueOf(String)
method.
Used by the default ConversionService as a fallback if there are no other explicit to-String converters registered.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter |
---|
GenericConverter.ConvertiblePair |
Constructor Summary | |
---|---|
ObjectToStringConverter()
|
Method Summary | |
---|---|
java.lang.Object |
convert(java.lang.Object source,
TypeDescriptor sourceType,
TypeDescriptor targetType)
Convert the source to the targetType described by the TypeDescriptor. |
java.util.Set<GenericConverter.ConvertiblePair> |
getConvertibleTypes()
Return the source and target types which this converter can convert between. |
boolean |
matches(TypeDescriptor sourceType,
TypeDescriptor targetType)
Should the converter from sourceType to targetType
currently under consideration be selected? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
ObjectToStringConverter()
Method Detail |
---|
public java.util.Set<GenericConverter.ConvertiblePair> getConvertibleTypes()
GenericConverter
Each entry is a convertible source-to-target type pair.
getConvertibleTypes
in interface GenericConverter
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType)
ConditionalGenericConverter
sourceType
to targetType
currently under consideration be selected?
matches
in interface ConditionalGenericConverter
sourceType
- the type descriptor of the field we are converting fromtargetType
- the type descriptor of the field we are converting to
public java.lang.Object convert(java.lang.Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
GenericConverter
convert
in interface GenericConverter
source
- the source object to convert (may be null)sourceType
- the type descriptor of the field we are converting fromtargetType
- the type descriptor of the field we are converting to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |