|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TypeConverter
Interface that defines type conversion methods. Typically (but not necessarily) implemented in conjunction with the PropertyEditorRegistry interface.
PropertyEditorRegistry
,
SimpleTypeConverter
,
BeanWrapperImpl
Method Summary | |
---|---|
Object |
convertIfNecessary(Object value,
Class requiredType)
Convert the value to the required type (if necessary from a String). |
Object |
convertIfNecessary(Object value,
Class requiredType,
MethodParameter methodParam)
Convert the value to the required type (if necessary from a String). |
Method Detail |
---|
Object convertIfNecessary(Object value, Class requiredType) throws TypeMismatchException
Conversions from String to any type will typically use the setAsText
method of the PropertyEditor class. Note that a PropertyEditor must be registered
for the given class for this to work; this is a standard JavaBeans API.
A number of PropertyEditors are automatically registered.
value
- the value to convertrequiredType
- the type we must convert to
(or null
if not known, for example in case of a collection element)
TypeMismatchException
- if type conversion failedPropertyEditor.setAsText(String)
,
PropertyEditor.getValue()
Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) throws TypeMismatchException
Conversions from String to any type will typically use the setAsText
method of the PropertyEditor class. Note that a PropertyEditor must be registered
for the given class for this to work; this is a standard JavaBeans API.
A number of PropertyEditors are automatically registered.
value
- the value to convertrequiredType
- the type we must convert to
(or null
if not known, for example in case of a collection element)methodParam
- the method parameter that is the target of the conversion
(for analysis of generic types; may be null
)
TypeMismatchException
- if type conversion failedPropertyEditor.setAsText(String)
,
PropertyEditor.getValue()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |