Top Description Methods
org.springframework.beans

public Interface PropertyEditorRegistry

Known Direct Subinterfaces
org.springframework.beans.ConfigurablePropertyAccessor
Known Direct Implementers
org.springframework.beans.PropertyEditorRegistrySupport
Imports
java.beans.PropertyEditor, org.springframework.lang.Nullable

Encapsulates methods for registering JavaBeans PropertyEditors. This is the central interface that a PropertyEditorRegistrar operates on.

Extended by BeanWrapper; implemented by BeanWrapperImpl and org.springframework.validation.DataBinder.

Author
Juergen Hoeller
Since
1.2.6
See Also
java.beans.PropertyEditor, PropertyEditorRegistrar, BeanWrapper, org.springframework.validation.DataBinder

Method Summary

Modifier and TypeMethod and Description
public PropertyEditor

Returns:

the registered editor, or null if none
findCustomEditor
(Class<?>
the type of the property (can be null if a property is given but should be specified in any case for consistency checking)
requiredType
,
String
the path of the property (name or nested path), or null if looking for an editor for all properties of the given type
propertyPath
)

Find a custom property editor for the given type and property.

public void
registerCustomEditor(Class<?>
the type of the property
requiredType
,
PropertyEditor
the editor to register
propertyEditor
)

Register the given custom property editor for all properties of the given type.

public void
registerCustomEditor(Class<?>
the type of the property. This may be null if a property is given but should be specified in any case, in particular in case of a Collection - making clear whether the editor is supposed to apply to the entire Collection itself or to each of its entries. So as a general rule: Do not specify null here in case of a Collection/array!
requiredType
,
String
the path of the property (name or nested path), or null if registering an editor for all properties of the given type
propertyPath
,
PropertyEditor
editor to register
propertyEditor
)

Register the given custom property editor for the given type and property, or for all properties of the given type.

Method Detail

findCustomEditorback to summary
public PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath)

Find a custom property editor for the given type and property.

Parameters
requiredType:Class<?>

the type of the property (can be null if a property is given but should be specified in any case for consistency checking)

propertyPath:String

the path of the property (name or nested path), or null if looking for an editor for all properties of the given type

Returns:PropertyEditor

the registered editor, or null if none

Annotations
@Nullable
registerCustomEditorback to summary
public void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor)

Register the given custom property editor for all properties of the given type.

Parameters
requiredType:Class<?>

the type of the property

propertyEditor:PropertyEditor

the editor to register

registerCustomEditorback to summary
public 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.

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.quantity" as the value of the 'propertyPath' argument to this method.

Parameters
requiredType:Class<?>

the type of the property. This may be null if a property is given but should be specified in any case, in particular in case of a Collection - making clear whether the editor is supposed to apply to the entire Collection itself or to each of its entries. So as a general rule: Do not specify null here in case of a Collection/array!

propertyPath:String

the path of the property (name or nested path), or null if registering an editor for all properties of the given type

propertyEditor:PropertyEditor

editor to register