com.novell.nds.dirxml.driver.xds
Class TypedEnumConstraint

java.lang.Object
  extended bycom.novell.nds.dirxml.driver.xds.Constraint
      extended bycom.novell.nds.dirxml.driver.xds.TypedEnumConstraint

public final class TypedEnumConstraint
extends Constraint

A constraint that lists the possible set of typed values for a Parameter. To avoid ClassCastExceptions, be sure the passed comparator can handle the passed type. For example DataType.STRING constraints will pass java.lang.Strings to the passed comparator.

e.g. ['true', 't', 'yes', 'y', '1']


Constructor Summary
TypedEnumConstraint(DataType someType, Comparator someComparator)
          Creates a new enumerative constraint instance.
 
Method Summary
 void add(Collection values)
          Adds multiple members to this constraint.
 void add(Object value)
          Adds a single member to this constraint.
 boolean canBeAppliedToMultipleParams()
          Can this constraint be applied to multiple Parameters?
 boolean equals(Object o)
          Is the passed constraint equal to this constraint?
 boolean forScalar()
          Can this constrait be applied to a scalar Parameter?
 boolean forStructured()
          Can this constraint be applied to a structured Parameter?
 int hashCode()
          Returns this constraint's hashcode.
 void setNOT()
          Negates this constraint.
 
Methods inherited from class com.novell.nds.dirxml.driver.xds.Constraint
getNOT, getOperator, getType, getTypes, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TypedEnumConstraint

public TypedEnumConstraint(DataType someType,
                           Comparator someComparator)
Creates a new enumerative constraint instance.

Parameters:
someType - must not be null
someComparator - may be null
Method Detail

setNOT

public void setNOT()
Negates this constraint.


add

public void add(Object value)
Adds a single member to this constraint.

Parameters:
value - must not be null
Throws:
IllegalArgumentException - if someValue is null

add

public void add(Collection values)
Adds multiple members to this constraint.

Parameters:
values - must not be null

hashCode

public int hashCode()
Returns this constraint's hashcode.

Returns:
the hashcode

equals

public boolean equals(Object o)
Is the passed constraint equal to this constraint?

Parameters:
o - may be null
Returns:
true if they're equal; false if they're not

forStructured

public boolean forStructured()
Description copied from class: Constraint
Can this constraint be applied to a structured Parameter?

A structured Parameter consists of multiple primitives or other structured Parameters.

Specified by:
forStructured in class Constraint
Returns:
true if it can; false if it can't

forScalar

public boolean forScalar()
Description copied from class: Constraint
Can this constrait be applied to a scalar Parameter?

A scalar Parmeter is a primitive (e.g., long, int, boolean) that has a single value.

Specified by:
forScalar in class Constraint
Returns:
true if it can; false if it can't

canBeAppliedToMultipleParams

public boolean canBeAppliedToMultipleParams()
Description copied from class: Constraint
Can this constraint be applied to multiple Parameters?

Specified by:
canBeAppliedToMultipleParams in class Constraint
Returns:
true if it can; false if it can't