org.springframework.binding.support
Class ObjectPropertyAccessStrategy

java.lang.Object
  extended by org.springframework.binding.support.AbstractPropertyAccessStrategy
      extended by org.springframework.binding.support.ObjectPropertyAccessStrategy
All Implemented Interfaces:
MutablePropertyAccessStrategy, PropertyAccessStrategy

public class ObjectPropertyAccessStrategy
extends AbstractPropertyAccessStrategy

An implementation of MutablePropertyAccessStrategy that provides access to the properties of any object.

As this class delegates to a DefaultMemberPropertyAccessor for property access, there is full support for nested properties and collection types.

Author:
Arne Limburg
See Also:
DefaultMemberPropertyAccessor

Constructor Summary
  ObjectPropertyAccessStrategy(Object target)
          Creates a new instance of ObjectPropertyAccessStrategy that will provide access to the properties of the provided object.
protected ObjectPropertyAccessStrategy(ObjectPropertyAccessStrategy parent, String basePropertyPath)
          Creates a child instance of ObjectPropertyAccessStrategy that will delegate to its parent for property access.
  ObjectPropertyAccessStrategy(ValueModel domainObjectHolder)
          Creates a new instance of ObjectPropertyAccessStrategy that will provide access to the object contained by the provided value model.
  ObjectPropertyAccessStrategy(ValueModel domainObjectHolder, boolean fieldAccessEnabled)
          Creates a new instance of ObjectPropertyAccessStrategy that will provide access to the object contained by the provided value model.
  ObjectPropertyAccessStrategy(ValueModel domainObjectHolder, boolean fieldAccessEnabled, boolean strictNullValueHandling)
          Creates a new instance of ObjectPropertyAccessStrategy that will provide access to the object contained by the provided value model.
 
Method Summary
protected  void domainObjectChanged()
          Called when the domain object is changed.
protected  PropertyAccessor getPropertyAccessor()
          Provides DefaultMemberPropertyAccessor 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

ObjectPropertyAccessStrategy

public ObjectPropertyAccessStrategy(Object target)
Creates a new instance of ObjectPropertyAccessStrategy that will provide access to the properties of the provided object.

Parameters:
target - object to be accessed through this class.

ObjectPropertyAccessStrategy

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

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

ObjectPropertyAccessStrategy

public ObjectPropertyAccessStrategy(ValueModel domainObjectHolder,
                                    boolean fieldAccessEnabled)
Creates a new instance of ObjectPropertyAccessStrategy that will provide access to the object contained by the provided value model.

Parameters:
domainObjectHolder - value model that holds the object to be accessed through this class
fieldAccessEnabled - whether the fields of the objects should be accessed directly where possible instead of using methods

ObjectPropertyAccessStrategy

public ObjectPropertyAccessStrategy(ValueModel domainObjectHolder,
                                    boolean fieldAccessEnabled,
                                    boolean strictNullValueHandling)
Creates a new instance of ObjectPropertyAccessStrategy that will provide access to the object contained by the provided value model.

Parameters:
domainObjectHolder - value model that holds the object to be accessed through this class
fieldAccessEnabled - whether the fields of the objects should be accessed directly where possible instead of using methods
strictNullValueHandling - whether a NullValueInNestedPathException should be thrown on nested null-values or null should be returned

ObjectPropertyAccessStrategy

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

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

getPropertyAccessor

protected PropertyAccessor getPropertyAccessor()
Provides DefaultMemberPropertyAccessor access to subclasses.

Specified by:
getPropertyAccessor in class AbstractPropertyAccessStrategy

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.