org.springframework.rules.constraint
Class ClosureResultConstraint

java.lang.Object
  extended by org.springframework.rules.constraint.ClosureResultConstraint
All Implemented Interfaces:
Constraint

public class ClosureResultConstraint
extends Object
implements Constraint

Tests the result returned from evaluating a closure closure.

Author:
Keith Donald

Constructor Summary
ClosureResultConstraint(Closure closure, Constraint constraint)
          Creates a ClosureResultConstraint that tests the result returned from evaulating the specified unary closure.
 
Method Summary
 Closure getFunction()
           
 Constraint getPredicate()
           
 boolean test(Object argument)
          Tests the result returned by evaluating the specified argument against the configured closure.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClosureResultConstraint

public ClosureResultConstraint(Closure closure,
                               Constraint constraint)
Creates a ClosureResultConstraint that tests the result returned from evaulating the specified unary closure.

Parameters:
closure - The closure to test.
constraint - The predicate that will test the closure return value.
Method Detail

test

public boolean test(Object argument)
Tests the result returned by evaluating the specified argument against the configured closure.

Specified by:
test in interface Constraint
Parameters:
argument - the argument value
Returns:
true if the condition was satisfied, false otherwise
See Also:
Constraint.test(java.lang.Object)

getFunction

public Closure getFunction()

getPredicate

public Constraint getPredicate()

toString

public String toString()
Overrides:
toString in class Object


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