Class BaseWhereAdapter<T>

  • Direct Known Subclasses:
    WhereAdapter, WhereFragment

    public abstract class BaseWhereAdapter<T>
    extends java.lang.Object
    A piece of a where clause which isn't attached to a Select statement allowing getThis() bit to be reused where the statement/whereClause isn't yet established.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      T acos​(ColumnRef arg)
      Add ACOS(arg) to the expression
      T acos​(ExpNode arg)
      Add ACOS(arg) to the expression
      T add()
      Add + to the expression
      T and()
      Add an AND to the list of expression tokens
      T and​(ColumnRef ref)
      Add AND {ref} to the expression
      T and​(ExpNode predicate)
      Add AND {predicate} to the expression
      T and​(java.lang.String element)
      Add AND {element} to the expression where {element} is typically a simple column name
      T and​(java.lang.String tableAlias, java.lang.String columnName)
      Add AND {tableAlias}.{columnName} to the expression
      T bind​(java.lang.Double param)
      Add a bind marker and Double value to the expression.
      T bind​(java.lang.Integer param)
      Add a bind marker and Integer value to the expression.
      T bind​(java.lang.Long param)
      Add a bind marker and Long value to the expression.
      T bind​(java.lang.String param)
      Add a bind marker and its string value to the expression.
      T bind​(java.math.BigDecimal value)
      Add a bind marker and BigDecimal value to the expression.
      T bind​(java.time.Instant param)
      Add a bind marker and Instant value to the expression.
      T coalesce​(ColumnRef... columnRefs)
      Add a COALESCE(c1, c2, ...) function.
      T col​(java.lang.String expression)
      Add a column expression or reference
      T col​(java.lang.String tableAlias, java.lang.String expression)
      Add the qualified name {tableAlias}.{expression} to the expression
      T cos​(ColumnRef arg)
      Add COS(arg) to the expression
      T cos​(ExpNode arg)
      Add COS(arg) to the expression
      T div()
      Add / to the expression
      T eq()
      Add an equals '=' node to the expression
      T eq​(int literalValue)
      Add '= {literalValue}' to the expression
      T eq​(long literalValue)
      Add '= {literalValue}' to the expression
      T eq​(ColumnRef ref)
      Add '= {ref}' to the expression
      T eq​(LiteralString str)
      Add '= {str}' to the expression
      T eq​(BindMarkerNode bindMarker)
      Add a bind marker and value to the expression
      T eq​(java.lang.String columnExpression)
      Add '= {columnExpression}' to the expression
      T eq​(java.lang.String tableAlias, java.lang.String columnExpression)
      Add '= {tableAlias}.{columnExpression}' to the expression
      T escape()
      Add ESCAPE to the expression
      T escape​(ColumnRef ref)
      Add ESCAPE {ref} to the expression
      T escape​(BindMarkerNode bindMarker)
      Add ESCAPE ? to the expression
      T escape​(java.lang.String str)
      Add ESCAPE {str} to the expression
      T escape​(java.lang.String tableAlias, java.lang.String columnExpression)
      Add ESCAPE {tableAlias}.{columnExpression} to the expression
      T exists​(Select correlatedSubSelect)
      Add an exists clause using the given correlated sub-select statement
      T filter​(ExpNode filter)
      Add the expression directly without any other operator
      ExpNode getExpression()
      Get the expression that has been built
      protected PredicateParser getPredicateParser()
      Getter for the predicate parser
      protected abstract T getThis()
      Returns the sub-class type-specific instance of the class.
      T gt()
      Add > to the expression
      T gt​(int literalValue)
      Add > {literalValue} to the expression
      T gt​(long literalValue)
      Add > {literalValue} to the expression
      T gt​(ColumnRef ref)
      Add > {ref} to the expression
      T gt​(BindMarkerNode bindMarker)
      Add a bind marker and its value to the expression
      T gt​(java.lang.String literalValue)
      Add > {literalValue} to the expression
      T gte()
      Add >= to the expression
      T gte​(int literalValue)
      Add >= {literalValue} to the expression
      T gte​(long literalValue)
      Add >= {literalValue} to the expression
      T gte​(ColumnRef ref)
      Add >= {ref} to the expression
      T gte​(BindMarkerNode bindMarker)
      Add >= {bindMarker} to the expression
      T gte​(java.lang.String literalValue)
      Add >= {literalValue} to the expression
      T in​(java.lang.Long[] inList)
      Add IN (?, ?, ...) for a list of Long values
      T in​(java.lang.String[] inList)
      Add IN (?, ?, ...) for a list of String values
      T in​(java.util.List<java.lang.String> inList)
      Thanks to type erasure we can only have one type of list here.
      T inLiteral​(java.lang.Long[] inList)
      Add IN (123, 124, ...) for a literal list of Long values
      T inLiteralLong​(java.util.List<java.lang.Long> inList)
      Add IN (123, 124, ...) for a literal list of Long values
      T isNotNull()
      Add an IS NOT NULL operator to the expression
      T isNull()
      Add an IS NULL operator to the expression
      T leftParen()
      Add a left paren ( to the expression
      T like()
      Add LIKE to the expression
      T like​(ColumnRef ref)
      Add LIKE {ref} to the expression
      T like​(BindMarkerNode bindMarker)
      Add LIKE ? to the expression
      T like​(java.lang.String str)
      Add LIKE {str} to the expression
      T like​(java.lang.String tableAlias, java.lang.String columnExpression)
      Add LIKE {tableAlias}.{columnExpression} to the expression
      T literal​(double value)
      Add a literal double value to the expression
      T literal​(long value)
      Add a literal long value to the expression
      T literal​(java.lang.String value)
      Add a literal String value to the expression
      T lt()
      Add < to the expression
      T lt​(int literalValue)
      Add < {literalValue} to the expression
      T lt​(long literalValue)
      Add < {literalValue} to the expression
      T lt​(ColumnRef ref)
      Add < {ref} to the expression
      T lt​(BindMarkerNode bindMarker)
      Add < {bindMarker} to the expression
      T lt​(java.lang.String literalValue)
      Add < {literalValue} to the expression
      T lte()
      Add <= to the expression
      T lte​(int literalValue)
      Add <= {literalValue} to the expression
      T lte​(long literalValue)
      Add <= {literalValue} to the expression
      T lte​(ColumnRef ref)
      Add <= ref to the expression
      T lte​(BindMarkerNode bindMarker)
      Add <= {bindMarker} to the expression
      T lte​(java.lang.String literalValue)
      Add <= {literalValue} to the expression
      T mult()
      Add * to the expression
      T neq()
      Add != to the expression
      T neq​(int literalValue)
      Add != {literalValue} to the expression
      T neq​(long literalValue)
      Add != {literalValue} to the expression
      T neq​(ColumnRef ref)
      Add != {ref} to the expression
      T neq​(LiteralString str)
      Add != {str} to the expression
      T neq​(BindMarkerNode bindMarker)
      Add a bind marker and its value to the expression
      T neq​(java.lang.String literalValue)
      Add != {literalValue} to the expression
      T not​(ExpNode expr)
      Add NOT to the expression
      T notExists​(Select correlatedSubSelect)
      Add a NOT EXISTS clause using the given correlated sub-select statement
      T operator​(Operator op)
      Add the operator op to the expression
      T or()
      Add OR to the expression
      T or​(ColumnRef ref)
      Add OR {ref} to the expression
      T or​(ExpNode predicate)
      Add OR {predicate} to the expression
      T or​(java.lang.String element)
      Add OR {element} to the expression where element is typically a column name
      T or​(java.lang.String tableAlias, java.lang.String columnName)
      Add OR {tableAlias}.{columnName} to the expression
      T radians​(ColumnRef arg)
      Add RADIANS(arg) to the expression
      T radians​(ExpNode arg)
      Add RADIANS(arg) to the expression
      T rightParen()
      Add a right paren ) to the expression
      T sin​(ColumnRef arg)
      Add SIN(arg) to the expression
      T sin​(ExpNode arg)
      Add SIN(arg) to the expression
      T sub()
      Add - to the expression
      T where​(java.lang.String columnName)
      To simplify code, support multiple where clauses, treating each as an AND
      T where​(java.lang.String tableAlias, java.lang.String columnName)
      To simplify code, support multiple where clauses, treating each as an AND
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseWhereAdapter

        protected BaseWhereAdapter()
        For building standalone predicates like filters
      • BaseWhereAdapter

        protected BaseWhereAdapter​(PredicateParser pp)
        Adopts an existing predicate parser
        Parameters:
        pp -
    • Method Detail

      • getThis

        protected abstract T getThis()
        Returns the sub-class type-specific instance of the class. Used as the return value in fluent methods.
        Returns:
      • getPredicateParser

        protected PredicateParser getPredicateParser()
        Getter for the predicate parser
        Returns:
      • getExpression

        public ExpNode getExpression()
        Get the expression that has been built
        Returns:
      • literal

        public T literal​(java.lang.String value)
        Add a literal String value to the expression
        Parameters:
        value -
        Returns:
      • literal

        public T literal​(long value)
        Add a literal long value to the expression
        Parameters:
        value -
        Returns:
      • literal

        public T literal​(double value)
        Add a literal double value to the expression
        Parameters:
        value -
        Returns:
      • eq

        public T eq()
        Add an equals '=' node to the expression
        Returns:
      • eq

        public T eq​(ColumnRef ref)
        Add '= {ref}' to the expression
        Parameters:
        ref -
        Returns:
      • eq

        public T eq​(long literalValue)
        Add '= {literalValue}' to the expression
        Parameters:
        literalValue -
        Returns:
      • eq

        public T eq​(int literalValue)
        Add '= {literalValue}' to the expression
        Parameters:
        literalValue -
        Returns:
      • eq

        public T eq​(java.lang.String columnExpression)
        Add '= {columnExpression}' to the expression
        Parameters:
        literalValue -
        Returns:
      • eq

        public T eq​(LiteralString str)
        Add '= {str}' to the expression
        Parameters:
        str -
        Returns:
      • eq

        public T eq​(java.lang.String tableAlias,
                    java.lang.String columnExpression)
        Add '= {tableAlias}.{columnExpression}' to the expression
        Parameters:
        literalValue -
        Returns:
      • eq

        public T eq​(BindMarkerNode bindMarker)
        Add a bind marker and value to the expression
        Parameters:
        bindMarker -
        Returns:
      • where

        public T where​(java.lang.String columnName)
        To simplify code, support multiple where clauses, treating each as an AND
        Parameters:
        columnName -
        Returns:
      • where

        public T where​(java.lang.String tableAlias,
                       java.lang.String columnName)
        To simplify code, support multiple where clauses, treating each as an AND
        Parameters:
        tableAlias -
        columnName -
        Returns:
      • and

        public T and()
        Add an AND to the list of expression tokens
        Returns:
      • and

        public T and​(ExpNode predicate)
        Add AND {predicate} to the expression
        Parameters:
        predicate -
        Returns:
      • and

        public T and​(java.lang.String element)
        Add AND {element} to the expression where {element} is typically a simple column name
      • and

        public T and​(java.lang.String tableAlias,
                     java.lang.String columnName)
        Add AND {tableAlias}.{columnName} to the expression
        Parameters:
        tableAlias -
        columnName -
        Returns:
      • and

        public T and​(ColumnRef ref)
        Add AND {ref} to the expression
        Parameters:
        ref - the column reference
        Returns:
      • or

        public T or()
        Add OR to the expression
        Returns:
      • or

        public T or​(ExpNode predicate)
        Add OR {predicate} to the expression
        Parameters:
        predicate -
        Returns:
      • or

        public T or​(java.lang.String element)
        Add OR {element} to the expression where element is typically a column name
        Parameters:
        element -
        Returns:
      • or

        public T or​(java.lang.String tableAlias,
                    java.lang.String columnName)
        Add OR {tableAlias}.{columnName} to the expression
        Parameters:
        tableAlias -
        columnName -
        Returns:
      • or

        public T or​(ColumnRef ref)
        Add OR {ref} to the expression
        Parameters:
        ref - the column reference
        Returns:
      • neq

        public T neq()
        Add != to the expression
        Returns:
      • neq

        public T neq​(ColumnRef ref)
        Add != {ref} to the expression
        Parameters:
        ref - the column reference
        Returns:
      • neq

        public T neq​(long literalValue)
        Add != {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • neq

        public T neq​(int literalValue)
        Add != {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • neq

        public T neq​(java.lang.String literalValue)
        Add != {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • neq

        public T neq​(LiteralString str)
        Add != {str} to the expression
        Parameters:
        str - a literal string value
        Returns:
      • neq

        public T neq​(BindMarkerNode bindMarker)
        Add a bind marker and its value to the expression
        Parameters:
        bindMarker -
        Returns:
      • gt

        public T gt()
        Add > to the expression
        Returns:
      • gt

        public T gt​(ColumnRef ref)
        Add > {ref} to the expression
        Parameters:
        ref - the column reference
        Returns:
      • gt

        public T gt​(long literalValue)
        Add > {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • gt

        public T gt​(int literalValue)
        Add > {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • gt

        public T gt​(java.lang.String literalValue)
        Add > {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • gt

        public T gt​(BindMarkerNode bindMarker)
        Add a bind marker and its value to the expression
        Parameters:
        bindMarker -
        Returns:
      • gte

        public T gte()
        Add >= to the expression
        Returns:
      • gte

        public T gte​(ColumnRef ref)
        Add >= {ref} to the expression
        Parameters:
        ref - the column reference
        Returns:
      • gte

        public T gte​(long literalValue)
        Add >= {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • gte

        public T gte​(int literalValue)
        Add >= {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • gte

        public T gte​(java.lang.String literalValue)
        Add >= {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • gte

        public T gte​(BindMarkerNode bindMarker)
        Add >= {bindMarker} to the expression
        Parameters:
        bindMarker -
        Returns:
      • lt

        public T lt()
        Add < to the expression
        Returns:
      • lt

        public T lt​(ColumnRef ref)
        Add < {ref} to the expression
        Parameters:
        ref - the column reference
        Returns:
      • lt

        public T lt​(long literalValue)
        Add < {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • lt

        public T lt​(int literalValue)
        Add < {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • lt

        public T lt​(java.lang.String literalValue)
        Add < {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • lt

        public T lt​(BindMarkerNode bindMarker)
        Add < {bindMarker} to the expression
        Parameters:
        bindMarker -
        Returns:
      • lte

        public T lte()
        Add <= to the expression
        Returns:
      • lte

        public T lte​(ColumnRef ref)
        Add <= ref to the expression
        Parameters:
        ref -
        Returns:
      • lte

        public T lte​(long literalValue)
        Add <= {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • lte

        public T lte​(int literalValue)
        Add <= {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • lte

        public T lte​(java.lang.String literalValue)
        Add <= {literalValue} to the expression
        Parameters:
        literalValue -
        Returns:
      • lte

        public T lte​(BindMarkerNode bindMarker)
        Add <= {bindMarker} to the expression
        Parameters:
        bindMarker -
        Returns:
      • col

        public T col​(java.lang.String expression)
        Add a column expression or reference
        Parameters:
        expression -
        Returns:
      • col

        public T col​(java.lang.String tableAlias,
                     java.lang.String expression)
        Add the qualified name {tableAlias}.{expression} to the expression
        Parameters:
        tableAlias -
        expression -
        Returns:
      • exists

        public T exists​(Select correlatedSubSelect)
        Add an exists clause using the given correlated sub-select statement
        Parameters:
        correlatedSubSelect -
        Returns:
      • notExists

        public T notExists​(Select correlatedSubSelect)
        Add a NOT EXISTS clause using the given correlated sub-select statement
        Parameters:
        correlatedSubSelect -
        Returns:
      • not

        public T not​(ExpNode expr)
        Add NOT to the expression
        Parameters:
        expr -
        Returns:
      • mult

        public T mult()
        Add * to the expression
        Returns:
      • add

        public T add()
        Add + to the expression
        Returns:
      • sub

        public T sub()
        Add - to the expression
        Returns:
      • div

        public T div()
        Add / to the expression
        Returns:
      • coalesce

        public T coalesce​(ColumnRef... columnRefs)
        Add a COALESCE(c1, c2, ...) function. These should actually be column expressions, but for now we only need to model them as table.col values
        Parameters:
        columnRefs -
        Returns:
      • sin

        public T sin​(ExpNode arg)
        Add SIN(arg) to the expression
        Parameters:
        arg -
        Returns:
      • sin

        public T sin​(ColumnRef arg)
        Add SIN(arg) to the expression
        Parameters:
        arg -
        Returns:
      • cos

        public T cos​(ExpNode arg)
        Add COS(arg) to the expression
        Parameters:
        arg -
        Returns:
      • cos

        public T cos​(ColumnRef arg)
        Add COS(arg) to the expression
        Parameters:
        arg -
        Returns:
      • acos

        public T acos​(ExpNode arg)
        Add ACOS(arg) to the expression
        Parameters:
        arg -
        Returns:
      • acos

        public T acos​(ColumnRef arg)
        Add ACOS(arg) to the expression
        Parameters:
        arg -
        Returns:
      • radians

        public T radians​(ExpNode arg)
        Add RADIANS(arg) to the expression
        Parameters:
        arg -
        Returns:
      • radians

        public T radians​(ColumnRef arg)
        Add RADIANS(arg) to the expression
        Parameters:
        arg -
        Returns:
      • isNotNull

        public T isNotNull()
        Add an IS NOT NULL operator to the expression
        Returns:
      • isNull

        public T isNull()
        Add an IS NULL operator to the expression
        Returns:
      • leftParen

        public T leftParen()
        Add a left paren ( to the expression
      • rightParen

        public T rightParen()
        Add a right paren ) to the expression
      • in

        public T in​(java.lang.String[] inList)
        Add IN (?, ?, ...) for a list of String values
        Parameters:
        inList -
        Returns:
      • in

        public T in​(java.util.List<java.lang.String> inList)
        Thanks to type erasure we can only have one type of list here. No overloading. String is the most likely type of field, so we go with that. Uses bind-markers, not literals.
        Parameters:
        inList -
        Returns:
      • in

        public T in​(java.lang.Long[] inList)
        Add IN (?, ?, ...) for a list of Long values
        Parameters:
        inList -
        Returns:
      • inLiteral

        public T inLiteral​(java.lang.Long[] inList)
        Add IN (123, 124, ...) for a literal list of Long values
        Parameters:
        inList -
        Returns:
      • inLiteralLong

        public T inLiteralLong​(java.util.List<java.lang.Long> inList)
        Add IN (123, 124, ...) for a literal list of Long values
        Parameters:
        inList -
        Returns:
      • like

        public T like()
        Add LIKE to the expression
        Returns:
      • like

        public T like​(ColumnRef ref)
        Add LIKE {ref} to the expression
        Parameters:
        ref -
        Returns:
      • like

        public T like​(java.lang.String str)
        Add LIKE {str} to the expression
        Parameters:
        str -
        Returns:
      • like

        public T like​(java.lang.String tableAlias,
                      java.lang.String columnExpression)
        Add LIKE {tableAlias}.{columnExpression} to the expression
        Parameters:
        tableAlias -
        columnExpression -
        Returns:
      • like

        public T like​(BindMarkerNode bindMarker)
        Add LIKE ? to the expression
        Parameters:
        bindMarker -
        Returns:
      • escape

        public T escape()
        Add ESCAPE to the expression
        Returns:
      • escape

        public T escape​(ColumnRef ref)
        Add ESCAPE {ref} to the expression
        Parameters:
        ref -
        Returns:
      • escape

        public T escape​(java.lang.String str)
        Add ESCAPE {str} to the expression
        Parameters:
        str -
        Returns:
      • escape

        public T escape​(java.lang.String tableAlias,
                        java.lang.String columnExpression)
        Add ESCAPE {tableAlias}.{columnExpression} to the expression
        Parameters:
        tableAlias -
        columnExpression -
        Returns:
      • escape

        public T escape​(BindMarkerNode bindMarker)
        Add ESCAPE ? to the expression
        Parameters:
        bindMarker -
        Returns:
      • filter

        public T filter​(ExpNode filter)
        Add the expression directly without any other operator
        Parameters:
        filter -
        Returns:
      • bind

        public T bind​(java.lang.String param)
        Add a bind marker and its string value to the expression. Handles null.
        Parameters:
        param -
        Returns:
      • bind

        public T bind​(java.lang.Long param)
        Add a bind marker and Long value to the expression. Handles null.
        Parameters:
        param -
        Returns:
      • bind

        public T bind​(java.lang.Integer param)
        Add a bind marker and Integer value to the expression. Handles null.
        Parameters:
        param -
        Returns:
      • bind

        public T bind​(java.lang.Double param)
        Add a bind marker and Double value to the expression. Handles null.
        Parameters:
        param -
        Returns:
      • bind

        public T bind​(java.time.Instant param)
        Add a bind marker and Instant value to the expression. Handles null.
        Parameters:
        param -
        Returns:
      • bind

        public T bind​(java.math.BigDecimal value)
        Add a bind marker and BigDecimal value to the expression. Handles null.
        Parameters:
        param -
        Returns:
      • operator

        public T operator​(Operator op)
        Add the operator op to the expression
        Parameters:
        op - the enum of the operator to add
        Returns: