jargs.gnu.validator
Class ValueSetValidator<E>
java.lang.Object
jargs.gnu.validator.AbstractValidator<E>
jargs.gnu.validator.ValueSetValidator<E>
public class ValueSetValidator<E>
- extends AbstractValidator<E>
Simple validator that checks if a given Object is in the Set of
accepted values.
- Author:
- Philipp Eichhorn
|
Constructor Summary |
ValueSetValidator(java.util.Set<E> validValues)
Constructs an ValueSetValidator. |
|
Method Summary |
java.lang.String |
toString()
|
boolean |
validate(E value)
Override to validate if an command-line option has a expected value. |
java.util.Set<E> |
validValues()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ValueSetValidator
public ValueSetValidator(java.util.Set<E> validValues)
- Constructs an ValueSetValidator.
- Parameters:
validValues - the Set of accepted values
validValues
public java.util.Set<E> validValues()
- Returns:
- the
Set of accepted values
validate
public boolean validate(E value)
- Description copied from class:
AbstractValidator
- Override to validate if an command-line option has a expected value.
- Specified by:
validate in class AbstractValidator<E>
- Parameters:
value - The Value extracted via an command-line option.
- Returns:
true if the value was valid, else
false.
toString
public java.lang.String toString()
- Overrides:
toString in class AbstractValidator<E>