A call to the validate()
method is delegated to each validation rule in the order they have been
added, until the first not-null ValidationState is
returned.
- Author:
- Michael Karneim
- See Also:
ValidationRule
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
equals, hashCode |
Validator
public Validator()
validate
public ValidationState validate()
- Validates the current context. That context is invalid when at least one
validation rule detects an invalid state. Produces a
ValidationState by delegating this call to the validation rules
in the same order they have been added, until a not-null value is
returned.
- Specified by:
validate in interface ValidationRule
- Returns:
- the fresh validation result of this rule.
add
public boolean add(ValidationRule o)
-
- Specified by:
add in interface java.util.Collection<ValidationRule>
add
public void add(int index,
ValidationRule o)
- Inserts the specified rule at the specified position in this validator.
- Parameters:
index - o -
addAll
public boolean addAll(java.util.Collection<? extends ValidationRule> c)
-
- Specified by:
addAll in interface java.util.Collection<ValidationRule>
clear
public void clear()
-
- Specified by:
clear in interface java.util.Collection<ValidationRule>
contains
public boolean contains(java.lang.Object o)
-
- Specified by:
contains in interface java.util.Collection<ValidationRule>
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
- Specified by:
containsAll in interface java.util.Collection<ValidationRule>
get
public ValidationRule get(int index)
- Returns the rule at the specified position in this
Validator
.
- Parameters:
index - index of the rule to return
- Returns:
- rule at the given index
isEmpty
public boolean isEmpty()
-
- Specified by:
isEmpty in interface java.util.Collection<ValidationRule>
iterator
public java.util.Iterator<ValidationRule> iterator()
-
- Specified by:
iterator in interface java.lang.Iterable<ValidationRule>- Specified by:
iterator in interface java.util.Collection<ValidationRule>
remove
public boolean remove(java.lang.Object o)
-
- Specified by:
remove in interface java.util.Collection<ValidationRule>
remove
public ValidationRule remove(int index)
- Removes the rule at the specified position in this
Validator
.
- Parameters:
index - index of the rule to remove
- Returns:
- removed rule from the given index
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
- Specified by:
removeAll in interface java.util.Collection<ValidationRule>
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
- Specified by:
retainAll in interface java.util.Collection<ValidationRule>
size
public int size()
-
- Specified by:
size in interface java.util.Collection<ValidationRule>
toArray
public java.lang.Object[] toArray()
-
- Specified by:
toArray in interface java.util.Collection<ValidationRule>
toArray
public <T> T[] toArray(T[] a)
-
- Specified by:
toArray in interface java.util.Collection<ValidationRule>
© 2010 by Michael Karneim, http://www.beanfabrics.org