Class AndSpecification<T>

  • Type Parameters:
    T - the type of the candidate object the specification applies to.
    All Implemented Interfaces:
    Specification<T>

    public class AndSpecification<T>
    extends Object
    implements Specification<T>
    A specification composing multiple specifications with a logical AND.
    • Constructor Detail

      • AndSpecification

        @SafeVarargs
        public AndSpecification​(Specification<? super T>... specifications)
        Creates a specification composing the specifications passed as argument with a logical AND.
        Parameters:
        specifications - the specifications to compose in a logical AND.
    • Method Detail

      • isSatisfiedBy

        public boolean isSatisfiedBy​(T candidate)
        Description copied from interface: Specification
        Evaluates if the candidate object passed as argument satisfies the specification.
        Specified by:
        isSatisfiedBy in interface Specification<T>
        Parameters:
        candidate - the candidate object to check.
        Returns:
        true if the candidate object satisfies the specification, false otherwise.
      • getSpecifications

        public Specification<? super T>[] getSpecifications()
        Returns the composed specifications.
        Returns:
        the array of specifications composed with the logical AND.