接口 PropertyEditorRegistry
- 所有已知子接口:
BeanWrapper
,ConfigurablePropertyAccessor
- 所有已知实现类:
AbstractNestablePropertyAccessor
,AbstractPropertyAccessor
,BeanWrapperImpl
,DataBinder
,DirectFieldAccessor
,ExtendedServletRequestDataBinder
,PortletRequestDataBinder
,PropertyEditorRegistrySupport
,ServletRequestDataBinder
,SimpleTypeConverter
,TypeConverterSupport
,WebDataBinder
,WebRequestDataBinder
public interface PropertyEditorRegistry
Encapsulates methods for registering JavaBeansPropertyEditors
. This is the central interface that aPropertyEditorRegistrar
operates on.Extended by
BeanWrapper
; implemented byBeanWrapperImpl
andDataBinder
.- 从以下版本开始:
- 1.2.6
- 作者:
- Juergen Hoeller
- 另请参阅:
PropertyEditor
,PropertyEditorRegistrar
,BeanWrapper
,DataBinder
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 PropertyEditor
findCustomEditor(Class<?> requiredType, String propertyPath)
Find a custom property editor for the given type and property.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.
方法详细资料
registerCustomEditor
void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor)
Register the given custom property editor for all properties of the given type.- 参数:
requiredType
- the type of the propertypropertyEditor
- the editor to register
registerCustomEditor
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 (thePropertyEditor
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.
- 参数:
requiredType
- the type of the property. This may benull
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 specifynull
here in case of a Collection/array!propertyPath
- the path of the property (name or nested path), ornull
if registering an editor for all properties of the given typepropertyEditor
- editor to register
findCustomEditor
PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath)
Find a custom property editor for the given type and property.- 参数:
requiredType
- the type of the property (can benull
if a property is given but should be specified in any case for consistency checking)propertyPath
- the path of the property (name or nested path), ornull
if looking for an editor for all properties of the given type- 返回:
- the registered editor, or
null
if none