Interface SpecificationBuilder


  • public interface SpecificationBuilder
    SpecificationBuilder is a DSL that facilitates the creation of complex composite specifications. It relies on expressing boolean predicates in the disjunctive normal form, which is a disjunction (OR) of conjunctive clauses (AND). In other words it requires that the predicates are expressed as an OR clause of AND clauses.

    Examples of formulae in DNF:

    • (A ∧ ¬B ∧ ¬C) ∨ (¬D ∧ E ∧ F)
    • (A ∧ B) ∨ C
    • A ∧ B
    • A ∨ B
    • A
    • Method Detail

      • of

        <T,​S extends PropertySelector<T,​S>> S of​(Class<T> anyClass)
        Starts the building of a composite specification that applies on any type.
        Type Parameters:
        T - the type of the object the specification applies to.
        S - the type of the selector.
        Parameters:
        anyClass - the class the specification applies to.
        Returns:
        the next operation of the builder DSL, allowing to select all or a part of the object the specification will apply to.
      • ofAggregate

        <A extends AggregateRoot<I>,​I,​S extends AggregateSelector<A,​I,​S>> S ofAggregate​(Class<A> aggregateClass)
        Starts the building of a composite specification that applies on any AggregateRoot.
        Type Parameters:
        A - the type of the aggregate the specification applies to.
        I - the type of the identifier of the aggregate.
        S - the type of the selector.
        Parameters:
        aggregateClass - the aggregate class the specification applies to.
        Returns:
        the next operation of the builder DSL, allowing to select all or a part of the object the specification will apply to.
      • satisfying

        <T,​S extends PropertySelector<T,​S>> OperatorPicker<T,​S> satisfying​(Specification<T> anySpec)
        Starts the building of a composite specification from an existing one. Expression 'of(someSpec)' is a equivalent 'of(SomeClass.class).whole().satisfying(someSpec)'.
        Type Parameters:
        T - the type of the object the specification applies to.
        S - the type of the selector.
        Parameters:
        anySpec - the existing specification to base the new specification on.
        Returns:
        the next operation of the builder DSL, allowing to select all or a part of the object the specification will apply to.