Package com.iplanet.ums.validation
Class SetValidator
- java.lang.Object
-
- com.iplanet.ums.validation.SetValidator
-
- All Implemented Interfaces:
IValidator
,Serializable
public class SetValidator extends Object implements IValidator
Validates if given value is in the set. This class implements IValidator interface. Default constructor should be used to create this object. Pass the string value to be validated and set of Stringvalues against which the value should be validated to validate function, true is returned if the value is present in the set.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.iplanet.ums.validation.IValidator
BAD_RULE, BAD_VALUE, PKG, PREFIX
-
-
Constructor Summary
Constructors Constructor Description SetValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
validate(String value, String set)
Checks if the value is in the set.
-
-
-
Method Detail
-
validate
public boolean validate(String value, String set)
Checks if the value is in the set. Validates the string value against the rule, which is a set of elements in the form of a String, with each elements separated by comma.Example: validate("A", "A,B,C,D,F"); // returns true validate("408", "415,650,408,510"); // returns true validate("770", "415,650,408,510"); // returns false validate(408, "415,650,408,510"); // exception
- Specified by:
validate
in interfaceIValidator
- Parameters:
value
- Value to validate.set
- Set used by the validation, in the form of a String with each elements separated by comma.- Returns:
- true if value is in the set
-
-