Class OrSpecification<T>

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

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

      • OrSpecification

        @SafeVarargs
        public OrSpecification​(Specification<? super T>... specifications)
        Creates a specification composing the specifications passed as argument with a logical OR.
        Parameters:
        specifications - the specifications to compose in a logical OR.
    • 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 specifications composed with the logical AND.