org.springframework.beans
Interface PropertyAccessor

All Known Subinterfaces:
BeanWrapper
All Known Implementing Classes:
BeanWrapperImpl

public interface PropertyAccessor

Common interface for classes that can access bean properties. Serves as base interface for BeanWrapper.

Since:
1.1
Author:
Juergen Hoeller
See Also:
BeanWrapper

Field Summary
static String NESTED_PROPERTY_SEPARATOR
          Path separator for nested properties.
static char NESTED_PROPERTY_SEPARATOR_CHAR
           
static String PROPERTY_KEY_PREFIX
          Marker that indicates the start of a property key for an indexed or mapped property like "person.addresses[0]".
static char PROPERTY_KEY_PREFIX_CHAR
           
static String PROPERTY_KEY_SUFFIX
          Marker that indicates the end of a property key for an indexed or mapped property like "person.addresses[0]".
static char PROPERTY_KEY_SUFFIX_CHAR
           
 
Method Summary
 Object getPropertyValue(String propertyName)
          Get the value of a property.
 void setPropertyValue(PropertyValue pv)
          Update a property value.
 void setPropertyValue(String propertyName, Object value)
          Set a property value.
 void setPropertyValues(Map map)
          Perform a bulk update from a Map.
 void setPropertyValues(PropertyValues pvs)
          The preferred way to perform a bulk update.
 void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown)
          Perform a bulk update with full control over behavior.
 

Field Detail

NESTED_PROPERTY_SEPARATOR

static final String NESTED_PROPERTY_SEPARATOR
Path separator for nested properties. Follows normal Java conventions: getFoo().getBar() would be "foo.bar".

See Also:
Constant Field Values

NESTED_PROPERTY_SEPARATOR_CHAR

static final char NESTED_PROPERTY_SEPARATOR_CHAR
See Also:
Constant Field Values

PROPERTY_KEY_PREFIX

static final String PROPERTY_KEY_PREFIX
Marker that indicates the start of a property key for an indexed or mapped property like "person.addresses[0]".

See Also:
Constant Field Values

PROPERTY_KEY_PREFIX_CHAR

static final char PROPERTY_KEY_PREFIX_CHAR
See Also:
Constant Field Values

PROPERTY_KEY_SUFFIX

static final String PROPERTY_KEY_SUFFIX
Marker that indicates the end of a property key for an indexed or mapped property like "person.addresses[0]".

See Also:
Constant Field Values

PROPERTY_KEY_SUFFIX_CHAR

static final char PROPERTY_KEY_SUFFIX_CHAR
See Also:
Constant Field Values
Method Detail

getPropertyValue

Object getPropertyValue(String propertyName)
                        throws BeansException
Get the value of a property.

Parameters:
propertyName - name of the property to get the value of
Returns:
the value of the property
Throws:
FatalBeanException - if there is no such property, if the property isn't readable, or if the property getter throws an exception.
BeansException

setPropertyValue

void setPropertyValue(String propertyName,
                      Object value)
                      throws BeansException
Set a property value. This method is provided for convenience only. The setPropertyValue(PropertyValue) method is more powerful.

Parameters:
propertyName - name of the property to set value of
value - the new value
Throws:
FatalBeanException - if there is no such property, if the property isn't writable, or if the property setter throws an exception.
BeansException

setPropertyValue

void setPropertyValue(PropertyValue pv)
                      throws BeansException
Update a property value. This is the preferred way to update an individual property.

Parameters:
pv - object containing new property value
Throws:
FatalBeanException - if there is no such property, if the property isn't writable, or if the property setter throws an exception.
BeansException

setPropertyValues

void setPropertyValues(Map map)
                       throws BeansException
Perform a bulk update from a Map.

Bulk updates from PropertyValues are more powerful: This method is provided for convenience. Behaviour will be identical to that of the setPropertyValues(PropertyValues) method.

Parameters:
map - Map to take properties from. Contains property value objects, keyed by property name
Throws:
FatalBeanException - if there is no such property, if the property isn't writable, or if the property setter throws an exception.
BeansException

setPropertyValues

void setPropertyValues(PropertyValues pvs)
                       throws BeansException
The preferred way to perform a bulk update.

Note that performing a bulk update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyAccessExceptionsException containing all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated stay changed.

Does not allow unknown fields. Equivalent to setPropertyValues(pvs, false).

Parameters:
pvs - PropertyValues to set on the target object
Throws:
FatalBeanException - if there is no such property, if the property isn't writable, or if the property setter throws an exception.
BeansException
See Also:
setPropertyValues(PropertyValues, boolean)

setPropertyValues

void setPropertyValues(PropertyValues pvs,
                       boolean ignoreUnknown)
                       throws BeansException
Perform a bulk update with full control over behavior.

Note that performing a bulk update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyAccessExceptionsException containing all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated stay changed.

Does not allow unknown fields.

Parameters:
pvs - PropertyValues to set on the target object
ignoreUnknown - should we ignore unknown values (not found in the bean)
Throws:
FatalBeanException - if there is no such property, if the property isn't writable, or if the property setter throws an exception.
BeansException


Copyright (c) 2002-2006 The Spring Framework Project.