PropertyEditorRegistry interface.
Provides management of default editors and custom editors.
Mainly serves as base class for BeanWrapperImpl.
java.beans.PropertyEditorManager , java.beans.PropertyEditorSupport#setAsText , java.beans.PropertyEditorSupport#setValue
| Modifier and Type | Class and Description |
|---|---|
| private static class | PropertyEditorRegistrySupport.
Holder for a registered custom editor with property name. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private ConversionService | |
| private Map | |
| private Map | |
| private Map | |
| private Map | |
| private boolean | |
| private Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | addStrippedPropertyPaths(List<String>
the result list to add to strippedPaths, String the current nested path nestedPath, String the property path to check for keys/indexes to strip propertyPath)Add property paths with all variations of stripped keys and/or indexes. |
| protected void | copyCustomEditorsTo(PropertyEditorRegistry
the target registry to copy to target, String 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. If this is null, all editors will be copied. nestedProperty)Copy the custom editors registered in this instance to the given target registry. |
| protected void | copyDefaultEditorsTo(PropertyEditorRegistrySupport
the target registry to copy to target)Copy the default editors registered in this instance to the given target registry. |
| private void | |
| public PropertyEditor | findCustomEditor(Class<?>
the type of the property (can be requiredType, String null if a property
is given but should be specified in any case for consistency checking)the path of the property (name or nested path), or
propertyPath)null if looking for an editor for all properties of the given typeImplements org. Find a custom property editor for the given type and property. |
| public ConversionService | |
| private PropertyEditor | Returns: the custom editor, ornull if none specific for this propertythe property path to look for propertyName, Class<?> the type to look for requiredType)Get custom editor that has been registered for the given property. |
| private PropertyEditor | Returns: the custom editor, ornull if none found for this typethe type to look for requiredType)Get custom editor for the given type. |
| public PropertyEditor | Returns: the default editor, ornull if none foundtype of the property requiredType)Retrieve the default editor for the given property type, if any. |
| protected Class | Returns: the type of the property, ornull if not determinablethe property path to determine the type for propertyPath)Determine the property type for the given property path. |
| protected Class | Returns: the property type, ornull if not determinablethe name of the property propertyName)Guess the property type of the specified property from the registered custom editors (provided that they were registered for a specific type). |
| public boolean | Returns: whether a matching custom editor has been foundthe target type of the element
(can be elementType, String null if not known)the property path (typically of the array/collection;
can be propertyPath)null if not known)Determine whether this registry contains a custom editor for the specified array/collection element. |
| public void | overrideDefaultEditor(Class<?>
the type of the property requiredType, PropertyEditor the editor to register propertyEditor)Override the default editor for the specified type with the given property editor. |
| public void | registerCustomEditor(Class<?>
the type of the property requiredType, PropertyEditor the editor to register propertyEditor)Implements org. 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 requiredType, String 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!the path of the property (name or nested path), or
propertyPath, PropertyEditor null if registering an editor for all properties of the given typeeditor to register propertyEditor)Implements org. Register the given custom property editor for the given type and property, or for all properties of the given type. |
| protected void | registerDefaultEditors()
Activate the default editors for this registry instance, allowing for lazily registering default editors when needed. |
| public void | setConversionService(ConversionService conversionService)
Specify a |
| public void | useConfigValueEditors()
Activate config value editors which are only intended for configuration purposes,
such as |
| configValueEditorsActive | back to summary |
|---|---|
| private boolean configValueEditorsActive | |
| conversionService | back to summary |
|---|---|
| private ConversionService conversionService
| |
| customEditorCache | back to summary |
|---|---|
| private Map<Class<?>, PropertyEditor> customEditorCache
| |
| customEditors | back to summary |
|---|---|
| private Map<Class<?>, PropertyEditor> customEditors
| |
| customEditorsForPath | back to summary |
|---|---|
| private Map<String, PropertyEditorRegistrySupport. | |
| defaultEditors | back to summary |
|---|---|
| private Map<Class<?>, PropertyEditor> defaultEditors
| |
| defaultEditorsActive | back to summary |
|---|---|
| private boolean defaultEditorsActive | |
| overriddenDefaultEditors | back to summary |
|---|---|
| private Map<Class<?>, PropertyEditor> overriddenDefaultEditors
| |
| PropertyEditorRegistrySupport | back to summary |
|---|---|
| public PropertyEditorRegistrySupport() | |
| addStrippedPropertyPaths | back to summary |
|---|---|
| private void addStrippedPropertyPaths(List<String> strippedPaths, String nestedPath, String propertyPath) Add property paths with all variations of stripped keys and/or indexes. Invokes itself recursively with nested paths. | |
| copyCustomEditorsTo | back to summary |
|---|---|
| protected void copyCustomEditorsTo(PropertyEditorRegistry target, String nestedProperty) Copy the custom editors registered in this instance to the given target registry.
| |
| copyDefaultEditorsTo | back to summary |
|---|---|
| protected void copyDefaultEditorsTo(PropertyEditorRegistrySupport target) Copy the default editors registered in this instance to the given target registry.
| |
| createDefaultEditors | back to summary |
|---|---|
| private void createDefaultEditors() Actually register the default editors for this registry instance. | |
| findCustomEditor | back to summary |
|---|---|
| public PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath) Implements org. Doc from org. Find a custom property editor for the given type and property.
| |
| getConversionService | back to summary |
|---|---|
| public ConversionService getConversionService() Return the associated ConversionService, if any.
| |
| getCustomEditor | back to summary |
|---|---|
| private PropertyEditor getCustomEditor(String propertyName, Class<?> requiredType) Get custom editor that has been registered for the given property.
| |
| getCustomEditor | back to summary |
|---|---|
| private PropertyEditor getCustomEditor(Class<?> requiredType) Get custom editor for the given type. If no direct match found,
try custom editor for superclass (which will in any case be able
to render a value as String via
| |
| getDefaultEditor | back to summary |
|---|---|
| public PropertyEditor getDefaultEditor(Class<?> requiredType) Retrieve the default editor for the given property type, if any. Lazily registers the default editors, if they are active.
| |
| getPropertyType | back to summary |
|---|---|
| protected Class Determine the property type for the given property path. Called by The default implementation always returns
| |
| guessPropertyTypeFromEditors | back to summary |
|---|---|
| protected Class Guess the property type of the specified property from the registered custom editors (provided that they were registered for a specific type). | |
| hasCustomEditorForElement | back to summary |
|---|---|
| public boolean hasCustomEditorForElement(Class<?> elementType, String propertyPath) Determine whether this registry contains a custom editor for the specified array/collection element. | |
| overrideDefaultEditor | back to summary |
|---|---|
| public void overrideDefaultEditor(Class<?> requiredType, PropertyEditor propertyEditor) Override the default editor for the specified type with the given property editor. Note that this is different from registering a custom editor in that the editor semantically still is a default editor. A ConversionService will override such a default editor, whereas custom editors usually override the ConversionService.
| |
| registerCustomEditor | back to summary |
|---|---|
| public void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor) Implements org. Doc from org. Register the given custom property editor for all properties of the given type.
| |
| registerCustomEditor | back to summary |
|---|---|
| public void registerCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor) Implements org. Doc from org. 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 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.
| |
| registerDefaultEditors | back to summary |
|---|---|
| protected void registerDefaultEditors() Activate the default editors for this registry instance, allowing for lazily registering default editors when needed. | |
| setConversionService | back to summary |
|---|---|
| public void setConversionService(ConversionService conversionService) Specify a | |
| useConfigValueEditors | back to summary |
|---|---|
| public void useConfigValueEditors() Activate config value editors which are only intended for configuration purposes,
such as Those editors are not registered by default simply because they are in
general inappropriate for data binding purposes. Of course, you may register
them individually in any case, through | |
| Modifier and Type | Field and Description |
|---|---|
| private final PropertyEditor | |
| private final Class |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private PropertyEditor | |
| private PropertyEditor | |
| private Class |
| propertyEditor | back to summary |
|---|---|
| private final PropertyEditor propertyEditor | |
| registeredType | back to summary |
|---|---|
| private final Class<?> registeredType
| |
| CustomEditorHolder | back to summary |
|---|---|
| private CustomEditorHolder(PropertyEditor propertyEditor, Class<?> registeredType) | |
| getPropertyEditor | back to summary |
|---|---|
| private PropertyEditor getPropertyEditor() | |
| getPropertyEditor | back to summary |
|---|---|
private PropertyEditor getPropertyEditor(Class<?> requiredType)
| |
| getRegisteredType | back to summary |
|---|---|
private Class
| |