Class AndCriterion<T>

java.lang.Object
com.saperion.common.lang.criterion.AndCriterion<T>
Type Parameters:
T - type of testable objects
All Implemented Interfaces:
Criterion<T>

public final class AndCriterion<T> extends Object implements Criterion<T>

A Criterion that recombines two existing criteria.

Objects satisfy this AndCriterion if and only if they satisfy both constituting criteria.

This implementation is not synchronized. If the two constituting criteria are independent of each other (no side effects) and can be used by multiple threads concurrently, this AndCriterion can be used by multiple threads concurrently as well. In any other case if used by different threads concurrently, external synchronization is necessary.

Author:
agz
  • Constructor Details

    • AndCriterion

      public AndCriterion(Criterion<? super T> criterion1, Criterion<? super T> criterion2)
      Creates a new AndCriterion, that combines the two specified criteria.

      The specified criteria must not be null.

      Parameters:
      criterion1 - first underlying Criterion
      criterion2 - second underlying Criterion
  • Method Details

    • isSatisfiedBy

      public boolean isSatisfiedBy(T object)
      Description copied from interface: Criterion
      Returns whether the specified object satisfies this criterion.

      Implementations have to accept null-values without throwing exceptions.

      Specified by:
      isSatisfiedBy in interface Criterion<T>
      Parameters:
      object - object to test
      Returns:
      whether the specified object satisfies this criterion
    • toString

      public String toString()
      Overrides:
      toString in class Object