ConfigurablePropertyAccessor that provides the necessary
infrastructure for all typical use cases.
This accessor will convert collection and array values to the corresponding
target collections or arrays, if necessary. Custom property editors that deal
with collections or arrays can either be written via PropertyEditor's
setValue, or against a comma-delimited String via setAsText,
as String arrays are converted in such a format if the array itself is not
assignable.
registerCustomEditor, setPropertyValues, setPropertyValue, getPropertyValue, getPropertyType, BeanWrapper, PropertyEditorRegistrySupport
| Modifier and Type | Class and Description |
|---|---|
| protected abstract static class | AbstractNestablePropertyAccessor.PropertyHandler
A handler for a specific property. |
| protected static class | AbstractNestablePropertyAccessor.PropertyTokenHolder
Holder class used to store property tokens. |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private static final Log | logger
We'll create a lot of these objects, so we don't want a new logger every time. |
| private String | |
| private Map | nestedPropertyAccessors
Map with cached nested Accessors: nested path -> Accessor instance. |
| pack-priv Object | |
| pack-priv Object |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | AbstractNestablePropertyAccessor(boolean
whether to register default editors
(can be suppressed if the accessor won't need any type conversion) registerDefaultEditors)Create a new empty accessor. |
| protected | AbstractNestablePropertyAccessor(Object
the object wrapped by this accessor object)Create a new accessor for the given object. |
| protected | AbstractNestablePropertyAccessor(Class<?>
class to instantiate and wrap clazz)Create a new accessor, wrapping a new instance of the specified class. |
| protected | AbstractNestablePropertyAccessor(Object
the object wrapped by this accessor object, String the nested path of the object nestedPath, Object the root object at the top of the path rootObject)Create a new accessor for the given object, registering a nested path that the object is in. |
| protected | AbstractNestablePropertyAccessor(Object
the object wrapped by this accessor object, String the nested path of the object nestedPath, AbstractNestablePropertyAccessor the containing accessor (must not be parent)null)Create a new accessor for the given object, registering a nested path that the object is in. |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | |
| private Object | convertIfNecessary(String propertyName, Object oldValue, Object newValue, Class<?> requiredType, TypeDescriptor td)
|
| private PropertyValue | |
| protected abstract NotWritablePropertyException | createNotWritablePropertyException(String propertyName)
Create a |
| public int | |
| protected String | Returns: last component of the path (the property on the target bean)property accessor to work on pa, String property path we know is nested nestedPath)Get the last component of the path. |
| protected abstract AbstractNestablePropertyAccessor. | Returns: the handler for that property, ornull if it has not been foundthe name of a local property propertyName)Return a |
| public final String | |
| private AbstractNestablePropertyAccessor | Returns: the PropertyAccessor instance, either cached or newly createdproperty to create the PropertyAccessor for nestedProperty)Retrieve a Property accessor for the given nested property. |
| protected AbstractNestablePropertyAccessor | Returns: a property accessor for the target beanproperty path, which may be nested propertyPath)Recursively navigate to return a property accessor for the nested property path. |
| protected AbstractNestablePropertyAccessor. | Returns: the property descriptor for the specified property, ornull if not foundthe property to obtain the descriptor for propertyName)Return the |
| private Object | |
| private int | |
| private AbstractNestablePropertyAccessor. | Returns: representation of the parsed property tokensthe property name to parse propertyName)Parse the given property name into the corresponding property name tokens. |
| public Class | getPropertyType(String
the property to check
(may be a nested path and/or an indexed/mapped property) propertyName)Overrides org. Implements org. |
| public TypeDescriptor | getPropertyTypeDescriptor(String
the property to check
(may be a nested path and/or an indexed/mapped property) propertyName)Implements org. |
| public Object | getPropertyValue(String
name of the property to get the value of propertyName)Implements abstract org. Implements org. |
| protected Object | |
| public final Class | |
| public final Object | |
| public final Class | |
| public final Object | |
| private Object | |
| private void | growCollectionIfNecessary(Collection<Object> collection, int index, String name, AbstractNestablePropertyAccessor.
|
| public boolean | isReadableProperty(String
the property to check
(may be a nested path and/or an indexed/mapped property) propertyName)Implements org. |
| public boolean | isWritableProperty(String
the property to check
(may be a nested path and/or an indexed/mapped property) propertyName)Implements org. |
| protected abstract AbstractNestablePropertyAccessor | Returns: the nested PropertyAccessor instancethe object wrapped by this PropertyAccessor object, String the nested path of the object nestedPath)Create a new nested property accessor instance. |
| private Object | |
| private void | |
| private void | |
| public void | setAutoGrowCollectionLimit(int autoGrowCollectionLimit)
Specify a limit for array and collection auto-growing. |
| private Object | |
| public void | setPropertyValue(String
name of the property to set value of propertyName, Object the new value value)Implements abstract org. Implements org. |
| public void | setPropertyValue(PropertyValue
an object containing the new property value pv)Overrides org. Implements org. |
| protected void | |
| public void | setWrappedInstance(Object
the new target object object)Switch the target object, replacing the cached introspection results only if the class of the new object is different to that of the replaced object. |
| public void | setWrappedInstance(Object
the new target object object, String the nested path of the object nestedPath, Object the root object at the top of the path rootObject)Switch the target object, replacing the cached introspection results only if the class of the new object is different to that of the replaced object. |
| public String |
| autoGrowCollectionLimit | back to summary |
|---|---|
| private int autoGrowCollectionLimit | |
| logger | back to summary |
|---|---|
| private static final Log logger We'll create a lot of these objects, so we don't want a new logger every time. | |
| nestedPath | back to summary |
|---|---|
| private String nestedPath | |
| nestedPropertyAccessors | back to summary |
|---|---|
| private Map<String, AbstractNestablePropertyAccessor> nestedPropertyAccessors Map with cached nested Accessors: nested path -> Accessor instance. | |
| rootObject | back to summary |
|---|---|
| pack-priv Object rootObject
| |
| wrappedObject | back to summary |
|---|---|
| pack-priv Object wrappedObject
| |
| AbstractNestablePropertyAccessor | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor() Create a new empty accessor. Wrapped instance needs to be set afterwards. Registers default editors.
| |
| AbstractNestablePropertyAccessor | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor(boolean registerDefaultEditors) Create a new empty accessor. Wrapped instance needs to be set afterwards.
| |
| AbstractNestablePropertyAccessor | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor(Object object) Create a new accessor for the given object.
| |
| AbstractNestablePropertyAccessor | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor(Class<?> clazz) Create a new accessor, wrapping a new instance of the specified class.
| |
| AbstractNestablePropertyAccessor | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor(Object object, String nestedPath, Object rootObject) Create a new accessor for the given object, registering a nested path that the object is in. | |
| AbstractNestablePropertyAccessor | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor(Object object, String nestedPath, AbstractNestablePropertyAccessor parent) Create a new accessor for the given object, registering a nested path that the object is in.
| |
| convertForProperty | back to summary |
|---|---|
protected Object convertForProperty(String propertyName, Object oldValue, Object newValue, TypeDescriptor td) throws TypeMismatchException
| |
| convertIfNecessary | back to summary |
|---|---|
private Object convertIfNecessary(String propertyName, Object oldValue, Object newValue, Class<?> requiredType, TypeDescriptor td) throws TypeMismatchException
| |
| createDefaultPropertyValue | back to summary |
|---|---|
| private PropertyValue createDefaultPropertyValue(AbstractNestablePropertyAccessor. | |
| createNotWritablePropertyException | back to summary |
|---|---|
| protected abstract NotWritablePropertyException createNotWritablePropertyException(String propertyName) Create a | |
| getAutoGrowCollectionLimit | back to summary |
|---|---|
| public int getAutoGrowCollectionLimit() Return the limit for array and collection auto-growing. | |
| getFinalPath | back to summary |
|---|---|
| protected String getFinalPath(AbstractNestablePropertyAccessor pa, String nestedPath) Get the last component of the path. Also works if not nested.
| |
| getLocalPropertyHandler | back to summary |
|---|---|
| protected abstract AbstractNestablePropertyAccessor. Return a
| |
| getNestedPath | back to summary |
|---|---|
| public final String getNestedPath() Return the nested path of the object wrapped by this accessor. | |
| getNestedPropertyAccessor | back to summary |
|---|---|
| private AbstractNestablePropertyAccessor getNestedPropertyAccessor(String nestedProperty) Retrieve a Property accessor for the given nested property. Create a new one if not found in the cache. Note Caching nested PropertyAccessors is necessary now, to keep registered custom editors for nested properties.
| |
| getPropertyAccessorForPropertyPath | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor getPropertyAccessorForPropertyPath(String propertyPath) Recursively navigate to return a property accessor for the nested property path.
| |
| getPropertyHandler | back to summary |
|---|---|
| protected AbstractNestablePropertyAccessor. Return the
| |
| getPropertyHoldingValue | back to summary |
|---|---|
| private Object getPropertyHoldingValue(AbstractNestablePropertyAccessor. | |
| getPropertyNameKeyEnd | back to summary |
|---|---|
| private int getPropertyNameKeyEnd(String propertyName, int startIndex) | |
| getPropertyNameTokens | back to summary |
|---|---|
| private AbstractNestablePropertyAccessor. Parse the given property name into the corresponding property name tokens.
| |
| getPropertyType | back to summary |
|---|---|
| public Class Overrides org. Implements org. Doc from org. Determine the property type for the specified property, either checking the property descriptor or checking the value in case of an indexed or mapped element. | |
| getPropertyTypeDescriptor | back to summary |
|---|---|
| public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException Implements org. Doc from org. Return a type descriptor for the specified property: preferably from the read method, falling back to the write method.
| |
| getPropertyValue | back to summary |
|---|---|
| public Object getPropertyValue(String propertyName) throws BeansException Implements abstract org. Implements org. Doc from org. Actually get the value of a property. | |
| getPropertyValue | back to summary |
|---|---|
protected Object getPropertyValue(AbstractNestablePropertyAccessor.
| |
| getRootClass | back to summary |
|---|---|
| public final Class Return the class of the root object at the top of the path of this accessor.
| |
| getRootInstance | back to summary |
|---|---|
| public final Object getRootInstance() Return the root object at the top of the path of this accessor.
| |
| getWrappedClass | back to summary |
|---|---|
| public final Class | |
| getWrappedInstance | back to summary |
|---|---|
| public final Object getWrappedInstance() | |
| growArrayIfNecessary | back to summary |
|---|---|
| private Object growArrayIfNecessary(Object array, int index, String name) | |
| growCollectionIfNecessary | back to summary |
|---|---|
| private void growCollectionIfNecessary(Collection<Object> collection, int index, String name, AbstractNestablePropertyAccessor. | |
| isReadableProperty | back to summary |
|---|---|
| public boolean isReadableProperty(String propertyName) Implements org. Doc from org. Determine whether the specified property is readable. Returns | |
| isWritableProperty | back to summary |
|---|---|
| public boolean isWritableProperty(String propertyName) Implements org. Doc from org. Determine whether the specified property is writable. Returns | |
| newNestedPropertyAccessor | back to summary |
|---|---|
| protected abstract AbstractNestablePropertyAccessor newNestedPropertyAccessor(Object object, String nestedPath) Create a new nested property accessor instance. Can be overridden in subclasses to create a PropertyAccessor subclass.
| |
| newValue | back to summary |
|---|---|
| private Object newValue(Class<?> type, TypeDescriptor desc, String name) | |
| processKeyedProperty | back to summary |
|---|---|
private void processKeyedProperty(AbstractNestablePropertyAccessor.
| |
| processLocalProperty | back to summary |
|---|---|
| private void processLocalProperty(AbstractNestablePropertyAccessor. | |
| setAutoGrowCollectionLimit | back to summary |
|---|---|
| public void setAutoGrowCollectionLimit(int autoGrowCollectionLimit) Specify a limit for array and collection auto-growing. Default is unlimited on a plain accessor. | |
| setDefaultValue | back to summary |
|---|---|
| private Object setDefaultValue(AbstractNestablePropertyAccessor. | |
| setPropertyValue | back to summary |
|---|---|
| public void setPropertyValue(String propertyName, Object value) throws BeansException Implements abstract org. Implements org. Doc from org. Actually set a property value. | |
| setPropertyValue | back to summary |
|---|---|
| public void setPropertyValue(PropertyValue pv) throws BeansException Overrides org. Implements org. Doc from org. Set the specified value as current property value.
| |
| setPropertyValue | back to summary |
|---|---|
| protected void setPropertyValue(AbstractNestablePropertyAccessor. | |
| setWrappedInstance | back to summary |
|---|---|
| public void setWrappedInstance(Object object) Switch the target object, replacing the cached introspection results only if the class of the new object is different to that of the replaced object.
| |
| setWrappedInstance | back to summary |
|---|---|
| public void setWrappedInstance(Object object, String nestedPath, Object rootObject) Switch the target object, replacing the cached introspection results only if the class of the new object is different to that of the replaced object. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Class | |
| private final boolean | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public TypeDescriptor | |
| public TypeDescriptor | |
| public TypeDescriptor | |
| public Class | |
| public abstract ResolvableType | |
| public abstract Object | |
| public boolean | |
| public boolean | |
| public abstract TypeDescriptor | |
| public abstract void | |
| public boolean | |
| public abstract TypeDescriptor |
| propertyType | back to summary |
|---|---|
| private final Class<?> propertyType
| |
| readable | back to summary |
|---|---|
| private final boolean readable | |
| writable | back to summary |
|---|---|
| private final boolean writable | |
| PropertyHandler | back to summary |
|---|---|
| public PropertyHandler(Class<?> propertyType, boolean readable, boolean writable) | |
| getCollectionType | back to summary |
|---|---|
| public TypeDescriptor getCollectionType(int nestingLevel) | |
| getMapKeyType | back to summary |
|---|---|
| public TypeDescriptor getMapKeyType(int nestingLevel) | |
| getMapValueType | back to summary |
|---|---|
| public TypeDescriptor getMapValueType(int nestingLevel) | |
| getPropertyType | back to summary |
|---|---|
public Class
| |
| getResolvableType | back to summary |
|---|---|
| public abstract ResolvableType getResolvableType() | |
| getValue | back to summary |
|---|---|
public abstract Object getValue() throws Exception
| |
| isReadable | back to summary |
|---|---|
| public boolean isReadable() | |
| isWritable | back to summary |
|---|---|
| public boolean isWritable() | |
| nested | back to summary |
|---|---|
public abstract TypeDescriptor nested(int level)
| |
| setValue | back to summary |
|---|---|
| public abstract void setValue(Object value) throws Exception | |
| setValueFallbackIfPossible | back to summary |
|---|---|
| public boolean setValueFallbackIfPossible(Object value) | |
| toTypeDescriptor | back to summary |
|---|---|
| public abstract TypeDescriptor toTypeDescriptor() | |
| Access | Constructor and Description |
|---|---|
| public |
| actualName | back to summary |
|---|---|
| public String actualName | |
| canonicalName | back to summary |
|---|---|
| public String canonicalName | |
| keys | back to summary |
|---|---|
| public String[] keys
| |
| PropertyTokenHolder | back to summary |
|---|---|
| public PropertyTokenHolder(String name) | |