Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.util.validator
Class OrValidator

java.lang.Object
  extended by eu.esdihumboldt.util.validator.OrValidator
All Implemented Interfaces:
Validator

public class OrValidator
extends Object
implements Validator

Validator that only checks whether one of its known validators validate the given input.

Author:
Kai Schwierczek

Constructor Summary
OrValidator(Collection<Validator> validators)
          Constructs an OrValidator with the given validators.
 
Method Summary
 void addValidator(Validator validator)
          Adds the given Validator to this Validator.
OrValidators get flattened.
 String getDescription()
          Returns a human readable representation of this Validator.
 boolean isAlwaysTrue()
          Returns true, if this Validator validates all values to true.
The result must not necessarily be correct.
 String validate(Object value)
          Checks whether the given value is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrValidator

public OrValidator(Collection<Validator> validators)
Constructs an OrValidator with the given validators.

Parameters:
validators - the validators.
Method Detail

addValidator

public void addValidator(Validator validator)
Adds the given Validator to this Validator.
OrValidators get flattened.

Parameters:
validator - the validator to add

validate

public String validate(Object value)
Description copied from interface: Validator
Checks whether the given value is valid.

Specified by:
validate in interface Validator
Parameters:
value - the value to check
Returns:
null, if the value is valid, otherwise the reason why it's invalid
See Also:
Validator.validate(Object)

getDescription

public String getDescription()
Description copied from interface: Validator
Returns a human readable representation of this Validator.

Specified by:
getDescription in interface Validator
Returns:
a human readable representation of this Validator
See Also:
Validator.getDescription()

isAlwaysTrue

public boolean isAlwaysTrue()
Description copied from interface: Validator
Returns true, if this Validator validates all values to true.
The result must not necessarily be correct. If the validator does not know its result for sure it must return false.

Specified by:
isAlwaysTrue in interface Validator
Returns:
true, iff the validator knows for sure, that it validates all values to true
See Also:
Validator.isAlwaysTrue()

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d