Class BooleanBuilder

java.lang.Object
com.querydsl.core.BooleanBuilder
All Implemented Interfaces:
Expression<Boolean>, Predicate, Serializable, Cloneable

public final class BooleanBuilder extends Object implements Predicate, Cloneable
BooleanBuilder is a cascading builder for Predicate expressions. BooleanBuilder is a mutable Expression implementation.

Usage example:

 QEmployee employee = QEmployee.employee;
 BooleanBuilder builder = new BooleanBuilder();
 for (String name : names) {
     builder.or(employee.name.equalsIgnoreCase(name));
 }
 
Author:
tiwe
See Also:
  • Constructor Details

    • BooleanBuilder

      public BooleanBuilder()
      Create an empty BooleanBuilder
    • BooleanBuilder

      public BooleanBuilder(Predicate initial)
      Create a BooleanBuilder with the given initial value
      Parameters:
      initial - initial value
  • Method Details

    • accept

      public <R, C> R accept(Visitor<R,C> v, C context)
      Description copied from interface: Expression
      Accept the visitor with the given context
      Specified by:
      accept in interface Expression<Boolean>
      Type Parameters:
      R - return type
      C - context type
      Parameters:
      v - visitor
      context - context of visit
      Returns:
      result of visit
    • and

      public BooleanBuilder and(@Nullable @Nullable Predicate right)
      Create the intersection of this and the given predicate
      Parameters:
      right - right hand side of and operation
      Returns:
      the current object
    • andAnyOf

      public BooleanBuilder andAnyOf(Predicate... args)
      Create the intersection of this and the union of the given args (this && (arg1 || arg2 ... || argN))
      Parameters:
      args - union of predicates
      Returns:
      the current object
    • andNot

      public BooleanBuilder andNot(Predicate right)
      Create the insertion of this and the negation of the given predicate
      Parameters:
      right - predicate to be negated
      Returns:
      the current object
    • clone

      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getValue

      @Nullable public @Nullable Predicate getValue()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • hasValue

      public boolean hasValue()
      Returns true if the value is set, and false, if not
      Returns:
      true if initialized and false if not
    • not

      public BooleanBuilder not()
      Description copied from interface: Predicate
      Get the negation of the expression
      Specified by:
      not in interface Predicate
      Returns:
      negation
    • or

      public BooleanBuilder or(@Nullable @Nullable Predicate right)
      Create the union of this and the given predicate
      Parameters:
      right - right hand side of or operation
      Returns:
      the current object
    • orAllOf

      public BooleanBuilder orAllOf(Predicate... args)
      Create the union of this and the intersection of the given args (this || (arg1 && arg2 ... && argN))
      Parameters:
      args - intersection of predicates
      Returns:
      the current object
    • orNot

      public BooleanBuilder orNot(Predicate right)
      Create the union of this and the negation of the given predicate
      Parameters:
      right - predicate to be negated
      Returns:
      the current object
    • getType

      public Class<? extends Boolean> getType()
      Description copied from interface: Expression
      Get the java type for this expression
      Specified by:
      getType in interface Expression<Boolean>
      Returns:
      type of expression
    • toString

      public String toString()
      Overrides:
      toString in class Object