org.springframework.rules.constraint.property
Class CompoundPropertyConstraint

java.lang.Object
  extended by org.springframework.rules.constraint.property.CompoundPropertyConstraint
All Implemented Interfaces:
Constraint, PropertyConstraint

public class CompoundPropertyConstraint
extends Object
implements PropertyConstraint

Abstract base class for unary predicates which compose other predicates.

Author:
Keith Donald

Constructor Summary
CompoundPropertyConstraint(CompoundConstraint compoundConstraint)
          Constructs a compound predicate with no initial members.
 
Method Summary
 CompoundPropertyConstraint add(PropertyConstraint constraint)
          Add the specified predicate to the set of predicates aggregated by this compound predicate.
 Constraint getPredicate()
           
 String getPropertyName()
          Returns the constrained property name.
 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.
 Iterator iterator()
          Return an iterator over the aggregated predicates.
 boolean test(Object bean)
          Test the provided argument against this predicate's condition.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompoundPropertyConstraint

public CompoundPropertyConstraint(CompoundConstraint compoundConstraint)
Constructs a compound predicate with no initial members. It is expected the client will call "add" to add individual predicates.

Method Detail

getPropertyName

public String getPropertyName()
Description copied from interface: PropertyConstraint
Returns the constrained property name.

Specified by:
getPropertyName in interface PropertyConstraint
Returns:
The property name

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
Returns:
true or false

isCompoundRule

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

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

getPredicate

public Constraint getPredicate()

add

public CompoundPropertyConstraint add(PropertyConstraint constraint)
Add the specified predicate to the set of predicates aggregated by this compound predicate.

Parameters:
predicate - the predicate to add
Returns:
A reference to this, to support chaining.

iterator

public Iterator iterator()
Return an iterator over the aggregated predicates.

Returns:
An iterator

test

public boolean test(Object bean)
Description copied from interface: Constraint
Test the provided argument against this predicate's condition.

Specified by:
test in interface Constraint
Parameters:
bean - the argument value
Returns:
true if the condition was satisfied, false otherwise

toString

public String toString()
Overrides:
toString in class Object


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