org.springframework.rules.constraint.property
Class PropertiesConstraint

Show UML class diagram
java.lang.Object
  extended by org.springframework.rules.constraint.property.AbstractPropertyConstraint
      extended by org.springframework.rules.constraint.property.PropertiesConstraint
All Implemented Interfaces:
Constraint, PropertyConstraint

public class PropertiesConstraint
extends AbstractPropertyConstraint

A constraint that returns the result of a boolean expression that tests two variable bean property values. For example, pet.ageAtFirstVisit > pet.currentAge

Author:
Keith Donald

Constructor Summary
PropertiesConstraint(String propertyName, BinaryConstraint beanPropertyExpression, String otherPropertyName)
          Creates a BeanPropertyExpression
 
Method Summary
 BinaryConstraint getConstraint()
           
 String getOtherPropertyName()
           
 boolean isCompoundRule()
          Does this property constraint effect more than one property?
 boolean isDependentOn(String propertyName)
          Returns true if this property constraint is dependent on the provided propertyName for test evaluation; that is, it should be retested when propertyName changes.
protected  boolean test(PropertyAccessStrategy domainObjectAccessStrategy)
           
 String toString()
           
 
Methods inherited from class org.springframework.rules.constraint.property.AbstractPropertyConstraint
getPropertyName, setPropertyName, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertiesConstraint

public PropertiesConstraint(String propertyName,
                            BinaryConstraint beanPropertyExpression,
                            String otherPropertyName)
Creates a BeanPropertyExpression

Parameters:
propertyName - The first property participating in the expression.
beanPropertyExpression - The expression predicate that will test the two bean property values.
otherPropertyName - The second property participating in the expression.
Method Detail

isCompoundRule

public boolean isCompoundRule()
Description copied from interface: PropertyConstraint
Does this property constraint effect more than one property?

Specified by:
isCompoundRule in interface PropertyConstraint
Overrides:
isCompoundRule in class AbstractPropertyConstraint
Returns:
true if yes, false otherwise

isDependentOn

public boolean isDependentOn(String propertyName)
Description copied from interface: PropertyConstraint
Returns true if this property constraint is dependent on the provided propertyName for test evaluation; that is, it should be retested when propertyName changes.

Specified by:
isDependentOn in interface PropertyConstraint
Overrides:
isDependentOn in class AbstractPropertyConstraint
Returns:
true or false

getOtherPropertyName

public String getOtherPropertyName()

getConstraint

public BinaryConstraint getConstraint()

test

protected boolean test(PropertyAccessStrategy domainObjectAccessStrategy)
Specified by:
test in class AbstractPropertyConstraint

toString

public String toString()
Overrides:
toString in class AbstractPropertyConstraint


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