|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.beans.PropertyEditorRegistrySupport
org.springframework.beans.SimpleTypeConverter
public class SimpleTypeConverter
Simple implementation of the TypeConverter interface that does not operate on any specific target object. This is an alternative to using a full-blown BeanWrapperImpl instance for arbitrary type conversion needs.
BeanWrapperImpl| Constructor Summary | |
|---|---|
SimpleTypeConverter()
|
|
| Method Summary | ||
|---|---|---|
|
convertIfNecessary(Object value,
Class<T> requiredType)
Convert the value to the required type (if necessary from a String). |
|
|
convertIfNecessary(Object value,
Class<T> requiredType,
MethodParameter methodParam)
Convert the value to the required type (if necessary from a String). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleTypeConverter()
| Method Detail |
|---|
public <T> T convertIfNecessary(Object value,
Class<T> requiredType)
throws TypeMismatchException
TypeConverterConversions 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.
convertIfNecessary in interface TypeConvertervalue - 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()
public <T> T convertIfNecessary(Object value,
Class<T> requiredType,
MethodParameter methodParam)
throws TypeMismatchException
TypeConverterConversions 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.
convertIfNecessary in interface TypeConvertervalue - 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()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||