org.springframework.rules.constraint
Class CompoundConstraint

Show UML class diagram
java.lang.Object
  extended by org.springframework.rules.closure.support.AlgorithmsAccessor
      extended by org.springframework.rules.constraint.ConstraintsAccessor
          extended by org.springframework.rules.constraint.AbstractConstraint
              extended by org.springframework.rules.constraint.CompoundConstraint
All Implemented Interfaces:
Serializable, Constraint
Direct Known Subclasses:
And, Or, XOr

public abstract class CompoundConstraint
extends AbstractConstraint

Abstract base class for unary constraints which compose other constraints.

Author:
Keith Donald
See Also:
Serialized Form

Constructor Summary
CompoundConstraint()
          Constructs a compound constraint with no initial members.
CompoundConstraint(Constraint[] constraints)
          Creates a CompoundUnaryPredicate composed of the specified constraints.
CompoundConstraint(Constraint constraint1, Constraint constraint2)
          Creates a CompoundUnaryPredicate composed of two constraints.
 
Method Summary
 CompoundConstraint add(Constraint constraint)
          Add the specified constraint to the set of constraints aggregated by this compound constraint.
 CompoundConstraint addAll(List constraints)
          Add the list of constraints to the set of constraints aggregated by this compound constraint.
 void copyInto(CompoundConstraint p)
           
 Constraint get(int index)
           
 int indexOf(Constraint child)
           
 Iterator iterator()
          Return an iterator over the aggregated constraints.
 void remove(Constraint constraint)
           
 void set(int index, Constraint constraint)
           
 int size()
          Returns the number of constraints aggregated by this compound constraint.
abstract  boolean test(Object argument)
          Test the provided argument against this predicate's condition.
 String toString()
           
 void validateTypeSafety(Class constraintType)
           
 
Methods inherited from class org.springframework.rules.constraint.AbstractConstraint
allTrue, allTrue, anyTrue, anyTrue, findAll, findAll, findFirst, findFirst
 
Methods inherited from class org.springframework.rules.constraint.ConstraintsAccessor
all, all, and, any, any, bind, bind, bind, bind, bind, conjunction, disjunction, eq, eq, eq, eq, eq, eqProperty, eqProperty, getConstraints, gt, gt, gt, gt, gt, gt, gt, gte, gte, gte, gte, gte, gte, gte, gteProperty, gteProperty, gtProperty, gtProperty, ifTrue, ifTrueElse, inGroup, inGroup, inGroup, inRange, inRange, inRangeProperties, inRangeProperties, like, like, lt, lt, lt, lt, lt, lt, lt, lte, lte, lte, lte, lte, lte, lte, lteProperty, lteProperty, ltProperty, ltProperty, maxLength, method, minLength, not, not, or, present, present, range, range, range, range, range, range, range, regexp, regexp, required, required, testResultOf, unique, value
 
Methods inherited from class org.springframework.rules.closure.support.AlgorithmsAccessor
allTrue, allTrue, anyTrue, anyTrue, findAll, findAll, findFirst, findFirst, forEach, forEach, getAlgorithms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompoundConstraint

public CompoundConstraint()
Constructs a compound constraint with no initial members. It is expected the client will call "add" to add individual constraints.


CompoundConstraint

public CompoundConstraint(Constraint constraint1,
                          Constraint constraint2)
Creates a CompoundUnaryPredicate composed of two constraints.

Parameters:
constraint1 - the first constraint
constraint2 - the second constraint

CompoundConstraint

public CompoundConstraint(Constraint[] constraints)
Creates a CompoundUnaryPredicate composed of the specified constraints.

Parameters:
constraints - the aggregated constraints
Method Detail

add

public CompoundConstraint add(Constraint constraint)
Add the specified constraint to the set of constraints aggregated by this compound constraint.

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

addAll

public CompoundConstraint addAll(List constraints)
Add the list of constraints to the set of constraints aggregated by this compound constraint.

Parameters:
constraints - the list of constraints to add
Returns:
A reference to this, to support chaining.

remove

public void remove(Constraint constraint)

indexOf

public int indexOf(Constraint child)

get

public Constraint get(int index)

copyInto

public void copyInto(CompoundConstraint p)

set

public void set(int index,
                Constraint constraint)

iterator

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

Returns:
An iterator

size

public int size()
Returns the number of constraints aggregated by this compound constraint.

Returns:
The size.

test

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

Parameters:
argument - the argument value
Returns:
true if the condition was satisfied, false otherwise

validateTypeSafety

public void validateTypeSafety(Class constraintType)

toString

public String toString()
Overrides:
toString in class Object


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