|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.PropertyEditorRegistrySupport
public class PropertyEditorRegistrySupport
Base implementation of the PropertyEditorRegistry interface. Provides management of default editors and custom editors. Mainly serves as base class for BeanWrapperImpl.
PropertyEditorRegistry
,
BeanWrapperImpl
,
PropertyEditorManager
,
PropertyEditorSupport.setAsText(java.lang.String)
,
PropertyEditorSupport.setValue(java.lang.Object)
Constructor Summary | |
---|---|
PropertyEditorRegistrySupport()
|
Method Summary | |
---|---|
protected void |
copyCustomEditorsTo(PropertyEditorRegistry target,
String nestedProperty)
Copy the custom editors registered in this instance to the given target registry. |
protected void |
copyDefaultEditorsTo(PropertyEditorRegistrySupport target)
Copy the default editors registered in this instance to the given target registry. |
PropertyEditor |
findCustomEditor(Class requiredType,
String propertyPath)
Find a custom property editor for the given type and property. |
protected PropertyEditor |
getDefaultEditor(Class requiredType)
Retrieve the default editor for the given property type, if any. |
protected Class |
getPropertyType(String propertyPath)
Determine the property type for the given property path. |
protected Class |
guessPropertyTypeFromEditors(String propertyName)
Guess the property type of the specified property from the registered custom editors (provided that they were registered for a specific type). |
void |
registerCustomEditor(Class requiredType,
PropertyEditor propertyEditor)
Register the given custom property editor for all properties of the given type. |
void |
registerCustomEditor(Class requiredType,
String propertyPath,
PropertyEditor propertyEditor)
Register the given custom property editor for the given type and property, or for all properties of the given type. |
protected void |
registerDefaultEditors()
Register default editors in this instance, for restricted environments. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyEditorRegistrySupport()
Method Detail |
---|
protected void registerDefaultEditors()
Registers a CustomNumberEditor
for all primitive number types,
their corresponding wrapper types, BigInteger
and BigDecimal
.
ByteArrayPropertyEditor
,
ClassEditor
,
CharacterEditor
,
CustomBooleanEditor
,
CustomNumberEditor
,
CustomCollectionEditor
,
FileEditor
,
InputStreamEditor
,
JndiTemplateEditor
,
LocaleEditor
,
PropertiesEditor
,
PropertyValuesEditor
,
ResourceArrayPropertyEditor
,
ResourceEditor
,
StringArrayPropertyEditor
,
TransactionAttributeEditor
,
TransactionAttributeSourceEditor
,
URLEditor
protected PropertyEditor getDefaultEditor(Class requiredType)
requiredType
- type of the property
null
if none foundprotected void copyDefaultEditorsTo(PropertyEditorRegistrySupport target)
target
- the target registry to copy topublic void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor)
PropertyEditorRegistry
registerCustomEditor
in interface PropertyEditorRegistry
requiredType
- type of the propertypropertyEditor
- editor to registerpublic void registerCustomEditor(Class requiredType, String propertyPath, PropertyEditor propertyEditor)
PropertyEditorRegistry
If the property path denotes an array or Collection property,
the editor will get applied either to the array/Collection itself
(the PropertyEditor
has to create an array or Collection value) or
to each element (the PropertyEditor
has to create the element type),
depending on the specified required type.
Note: Only one single registered custom editor per property path is supported. In the case of a Collection/array, do not register an editor for both the Collection/array and each element on the same property.
For example, if you wanted to register an editor for "items[n].quantity" (for all values n), you would use "items.quality" as the value of the 'propertyPath' argument to this method.
registerCustomEditor
in interface PropertyEditorRegistry
requiredType
- type of the property (can be null
if a property
is given but should be specified in any case for consistency checking)propertyPath
- path of the property (name or nested path), or
null
if registering an editor for all properties of the given typepropertyEditor
- editor to registerpublic PropertyEditor findCustomEditor(Class requiredType, String propertyPath)
PropertyEditorRegistry
findCustomEditor
in interface PropertyEditorRegistry
requiredType
- type of the property (can be null
if a property
is given but should be specified in any case for consistency checking)propertyPath
- path of the property (name or nested path), or
null
if looking for an editor for all properties of the given type
null
if noneprotected Class getPropertyType(String propertyPath)
findCustomEditor
if no required type has been specified,
to be able to find a type-specific editor even if just given a property path.
Default implementation always returns null
.
BeanWrapperImpl overrides this with the standard getPropertyType
method as defined by the BeanWrapper interface.
propertyPath
- the property path to determine the type for
null
if not determinableBeanWrapper.getPropertyType(String)
protected Class guessPropertyTypeFromEditors(String propertyName)
propertyName
- the name of the property
null
if not determinableprotected void copyCustomEditorsTo(PropertyEditorRegistry target, String nestedProperty)
target
- the target registry to copy tonestedProperty
- the nested property path of the target registry, if any.
If this is non-null, only editors registered for a path below this nested property
will be copied.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |