|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.TypeConverterDelegate
class TypeConverterDelegate
Internal helper class for converting property values to target types.
Works on a given PropertyEditorRegistrySupport
instance.
Used as a delegate by BeanWrapperImpl
and SimpleTypeConverter
.
BeanWrapperImpl
,
SimpleTypeConverter
Constructor Summary | |
---|---|
TypeConverterDelegate(PropertyEditorRegistrySupport propertyEditorRegistry)
Create a new TypeConverterDelegate for the given editor registry. |
|
TypeConverterDelegate(PropertyEditorRegistrySupport propertyEditorRegistry,
Object targetObject)
Create a new TypeConverterDelegate for the given editor registry and bean instance. |
Method Summary | |
---|---|
Object |
convertIfNecessary(Object newValue,
Class requiredType,
MethodParameter methodParam)
Convert the value to the specified required type. |
Object |
convertIfNecessary(Object oldValue,
Object newValue,
PropertyDescriptor descriptor)
Convert the value to the required type for the specified property. |
Object |
convertIfNecessary(String propertyName,
Object oldValue,
Object newValue,
Class requiredType)
Convert the value to the required type for the specified property. |
protected Object |
convertIfNecessary(String propertyName,
Object oldValue,
Object newValue,
Class requiredType,
PropertyDescriptor descriptor,
MethodParameter methodParam)
Convert the value to the required type (if necessary from a String), for the specified property. |
protected Object |
convertToTypedArray(Object input,
String propertyName,
Class componentType)
|
protected Collection |
convertToTypedCollection(Collection original,
String propertyName,
MethodParameter methodParam)
|
protected Map |
convertToTypedMap(Map original,
String propertyName,
MethodParameter methodParam)
|
protected Object |
convertValue(Object newValue,
Class requiredType,
PropertyEditor pe,
Object oldValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeConverterDelegate(PropertyEditorRegistrySupport propertyEditorRegistry)
propertyEditorRegistry
- the editor registry to usepublic TypeConverterDelegate(PropertyEditorRegistrySupport propertyEditorRegistry, Object targetObject)
propertyEditorRegistry
- the editor registry to usetargetObject
- the target object to work on (as context that can be passed to editors)Method Detail |
---|
public Object convertIfNecessary(Object newValue, Class requiredType, MethodParameter methodParam) throws IllegalArgumentException
newValue
- proposed change valuerequiredType
- 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
(may be null
)
IllegalArgumentException
- if type conversion failedpublic Object convertIfNecessary(String propertyName, Object oldValue, Object newValue, Class requiredType) throws IllegalArgumentException
propertyName
- name of the propertyoldValue
- previous value, if available (may be null
)newValue
- proposed change valuerequiredType
- the type we must convert to
(or null
if not known, for example in case of a collection element)
IllegalArgumentException
- if type conversion failedpublic Object convertIfNecessary(Object oldValue, Object newValue, PropertyDescriptor descriptor) throws IllegalArgumentException
oldValue
- previous value, if available (may be null
)newValue
- proposed change valuedescriptor
- the JavaBeans descriptor for the property
IllegalArgumentException
- if type conversion failedprotected Object convertIfNecessary(String propertyName, Object oldValue, Object newValue, Class requiredType, PropertyDescriptor descriptor, MethodParameter methodParam) throws IllegalArgumentException
propertyName
- name of the propertyoldValue
- previous value, if available (may be null
)newValue
- proposed change valuerequiredType
- 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
(may be null
)
IllegalArgumentException
- if type conversion failedprotected Object convertValue(Object newValue, Class requiredType, PropertyEditor pe, Object oldValue)
protected Object convertToTypedArray(Object input, String propertyName, Class componentType)
protected Collection convertToTypedCollection(Collection original, String propertyName, MethodParameter methodParam)
protected Map convertToTypedMap(Map original, String propertyName, MethodParameter methodParam)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |