|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensaml.xml.security.CriteriaFilteringIterator<T>
T
- the type of candidate elements being evaluatedpublic class CriteriaFilteringIterator<T>
This implementation of Iterator
wraps another Iterator of a particular type, containing candidates
which are to be evaluated against a given set of EvaluableCriteria
. When the iterator is traversed,
criteria evaluation is performed on each candidate element of the underlying wrapped iterator
via EvaluableCriteria.evaluate(Object)
. Only those elements which satisfy the criteria indicated by
the criteria set are returned by the Iterator, as follows.
If the parameter meetAllCriteria
is true
, then all criteria in the criteria
set must be satisfied in order for the element to be returned. This in essence connects the criteria of the criteria
set with a logical AND
. If false
, then if an element satisfies any of the criteria of the
criteria set, it will be returned. This in essence connects the members of the criteria set with a logical
OR
.
If the parameter unevaluableSatisfies
is true
, then if a criteria's evaluation
of the candidate via EvaluableCriteria.evaluate(Object)
indicates that it is unable to evaluate
the candidate, the criteria will be considered satisfied as far as the determination of whether to return
the candidate. If false
, then the criteria will be considered unsatisfied for purposes
of this determination.
Care should be exercised in combining these two parameter values to achieve the desired result.
Field Summary | |
---|---|
private Iterator<? extends T> |
candidateIter
The candidates to evaluate. |
private Set<EvaluableCriteria<T>> |
criteriaSet
The set of criteria against which to evaluate the candidates. |
private T |
current
The current candidate which will be returned by the next call to next(). |
private boolean |
meetAll
Flag indicating whether the candidate must satisfy all the criteria in the set, or just one. |
private boolean |
unevaledSatisfies
Flag indicating how candidates which can not be evaluated by a criteria are to be handled. |
Constructor Summary | |
---|---|
CriteriaFilteringIterator(Iterator<? extends T> candidatesIterator,
Set<EvaluableCriteria<T>> criteria,
boolean meetAllCriteria,
boolean unevaluableSatisfies)
Constructor. |
Method Summary | |
---|---|
private T |
getNextMatch()
Get the next matching candidate. |
boolean |
hasNext()
|
private boolean |
match(T candidate)
Evaluate the candidate against all the criteria. |
T |
next()
|
void |
remove()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Iterator<? extends T> candidateIter
private Set<EvaluableCriteria<T>> criteriaSet
private boolean meetAll
private boolean unevaledSatisfies
private T current
Constructor Detail |
---|
public CriteriaFilteringIterator(Iterator<? extends T> candidatesIterator, Set<EvaluableCriteria<T>> criteria, boolean meetAllCriteria, boolean unevaluableSatisfies)
candidatesIterator
- the candidates to evaluatecriteria
- the set of criteria against which to evaluate the candidatesmeetAllCriteria
- whether a candidate must meet all criteria, or just oneunevaluableSatisfies
- whether a can-not-evaluate result of a particular criteria's evaluation
is treated as the candidate having satisfied or not satisfied the criteria, for purposes
of determinig whether to return the elementMethod Detail |
---|
public boolean hasNext()
hasNext
in interface Iterator<T>
public T next()
next
in interface Iterator<T>
public void remove()
remove
in interface Iterator<T>
private T getNextMatch()
private boolean match(T candidate)
candidate
- the candidate to evaluate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |