org.springframework.rules.constraint
Class InGroup

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

public class InGroup
extends Object
implements Constraint

A constraint that tests if an argument is one of a group. Similiar to a database's 'in' operator, and more convenient than using a bunch of ORs.

Author:
Keith Donald

Constructor Summary
InGroup(Object[] group)
           
InGroup(Set group)
           
 
Method Summary
 Iterator iterator()
          returns an iterator of the group elements
 boolean test(Object value)
          Tests the variable argument value is in this group.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InGroup

public InGroup(Set group)

InGroup

public InGroup(Object[] group)
Method Detail

iterator

public Iterator iterator()
returns an iterator of the group elements

Returns:
iterator containing the elements of the group.

test

public boolean test(Object value)
Tests the variable argument value is in this group.

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

toString

public String toString()
Overrides:
toString in class Object


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