org.springframework.binding.support
Class BeanPropertyAccessStrategy

java.lang.Object
  extended by org.springframework.binding.support.AbstractPropertyAccessStrategy
      extended by org.springframework.binding.support.BeanPropertyAccessStrategy
All Implemented Interfaces:
MutablePropertyAccessStrategy, PropertyAccessStrategy
Direct Known Subclasses:
AnnotationAwareBeanPropertyAccessStrategy

public class BeanPropertyAccessStrategy
extends AbstractPropertyAccessStrategy

An implementation of MutablePropertyAccessStrategy that provides access to the properties of a JavaBean.

As this class delegates to a BeanWrapper for property access, there is full support for nested properties, enabling the setting/getting of properties on subproperties to an unlimited depth.

Author:
Oliver Hutchison, Arne Limburg
See Also:
BeanWrapper

Constructor Summary
protected BeanPropertyAccessStrategy(BeanPropertyAccessStrategy parent, String basePropertyPath)
          Creates a child instance of BeanPropertyAccessStrategy that will delegate to its parent for property access.
  BeanPropertyAccessStrategy(Object bean)
          Creates a new instance of BeanPropertyAccessStrategy that will provide access to the properties of the provided JavaBean.
  BeanPropertyAccessStrategy(ValueModel domainObjectHolder)
          Creates a new instance of BeanPropertyAccessStrategy that will provide access to the JavaBean contained by the provided value model.
 
Method Summary
protected  void domainObjectChanged()
          Called when the domain object is changed.
protected  BeanWrapper getBeanWrapper()
          Provides BeanWrapper access to subclasses.
protected  PropertyAccessor getPropertyAccessor()
          Provides BeanWrapper access to subclasses.
 MutablePropertyAccessStrategy getPropertyAccessStrategyForPath(String propertyPath)
          Get a MutablePropertyAccessStrategy for the given property.
 MutablePropertyAccessStrategy newPropertyAccessStrategy(ValueModel domainObjectHolder)
          Return a new MutablePropertyAccessStrategy for the given valueModel.
 
Methods inherited from class org.springframework.binding.support.AbstractPropertyAccessStrategy
getAllUserMetadataFor, getDomainObject, getDomainObjectHolder, getFullPropertyPath, getLastPropertySeparatorIndex, getMetadataAccessStrategy, getParentPropertyPath, getPropertyName, getPropertyValue, getPropertyValueModel, getUserMetadataFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertyAccessStrategy

public BeanPropertyAccessStrategy(Object bean)
Creates a new instance of BeanPropertyAccessStrategy that will provide access to the properties of the provided JavaBean.

Parameters:
bean - JavaBean to be accessed through this class.

BeanPropertyAccessStrategy

public BeanPropertyAccessStrategy(ValueModel domainObjectHolder)
Creates a new instance of BeanPropertyAccessStrategy that will provide access to the JavaBean contained by the provided value model.

Parameters:
domainObjectHolder - value model that holds the JavaBean to be accessed through this class

BeanPropertyAccessStrategy

protected BeanPropertyAccessStrategy(BeanPropertyAccessStrategy parent,
                                     String basePropertyPath)
Creates a child instance of BeanPropertyAccessStrategy that will delegate to its parent for property access.

Parameters:
parent - BeanPropertyAccessStrategy which will be used to provide property access
basePropertyPath - property path that will as a base when accessing the parent BeanPropertyAccessStrategy
Method Detail

getBeanWrapper

protected BeanWrapper getBeanWrapper()
Provides BeanWrapper access to subclasses.

Returns:
Spring BeanWrapper used to access the bean.

getPropertyAccessor

protected PropertyAccessor getPropertyAccessor()
Provides BeanWrapper access to subclasses.

Specified by:
getPropertyAccessor in class AbstractPropertyAccessStrategy
Returns:
Spring BeanWrapper used to access the bean.

getPropertyAccessStrategyForPath

public MutablePropertyAccessStrategy getPropertyAccessStrategyForPath(String propertyPath)
                                                               throws BeansException
Description copied from interface: MutablePropertyAccessStrategy
Get a MutablePropertyAccessStrategy for the given property. TODO check why this exists and where this is used.

Specified by:
getPropertyAccessStrategyForPath in interface MutablePropertyAccessStrategy
Specified by:
getPropertyAccessStrategyForPath in class AbstractPropertyAccessStrategy
Parameters:
propertyPath - property.
Returns:
MutablePropertyAccessStrategy for the given property.
Throws:
BeansException

newPropertyAccessStrategy

public MutablePropertyAccessStrategy newPropertyAccessStrategy(ValueModel domainObjectHolder)
Description copied from interface: MutablePropertyAccessStrategy
Return a new MutablePropertyAccessStrategy for the given valueModel. TODO check why this exists and where this is used.

Specified by:
newPropertyAccessStrategy in interface MutablePropertyAccessStrategy
Specified by:
newPropertyAccessStrategy in class AbstractPropertyAccessStrategy
Parameters:
domainObjectHolder - a ValueModel containing the domainObject.
Returns:
a newly created MutablePropertyAccessStrategy.

domainObjectChanged

protected void domainObjectChanged()
Description copied from class: AbstractPropertyAccessStrategy
Called when the domain object is changed.

Specified by:
domainObjectChanged in class AbstractPropertyAccessStrategy


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.