Class BaseWhereAdapter<T>
- java.lang.Object
- 
- org.linuxforhealth.fhir.database.utils.query.BaseWhereAdapter<T>
 
- 
- Direct Known Subclasses:
- WhereAdapter,- WhereFragment
 
 public abstract class BaseWhereAdapter<T> extends java.lang.ObjectA piece of a where clause which isn't attached to aSelectstatement allowing getThis() bit to be reused where the statement/whereClause isn't yet established.
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedBaseWhereAdapter()For building standalone predicates like filtersprotectedBaseWhereAdapter(PredicateParser pp)Adopts an existing predicate parser
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tacos(ColumnRef arg)Add ACOS(arg) to the expressionTacos(ExpNode arg)Add ACOS(arg) to the expressionTadd()Add + to the expressionTand()Add an AND to the list of expression tokensTand(java.lang.String element)Add AND {element} to the expression where {element} is typically a simple column nameTand(java.lang.String tableAlias, java.lang.String columnName)Add AND {tableAlias}.{columnName} to the expressionTand(ColumnRef ref)Add AND {ref} to the expressionTand(ExpNode predicate)Add AND {predicate} to the expressionTbind(java.lang.Double param)Add a bind marker and Double value to the expression.Tbind(java.lang.Integer param)Add a bind marker and Integer value to the expression.Tbind(java.lang.Long param)Add a bind marker and Long value to the expression.Tbind(java.lang.String param)Add a bind marker and its string value to the expression.Tbind(java.math.BigDecimal value)Add a bind marker and BigDecimal value to the expression.Tbind(java.time.Instant param)Add a bind marker and Instant value to the expression.Tcoalesce(ColumnRef... columnRefs)Add a COALESCE(c1, c2, ...) function.Tcol(java.lang.String expression)Add a column expression or referenceTcol(java.lang.String tableAlias, java.lang.String expression)Add the qualified name {tableAlias}.{expression} to the expressionTcos(ColumnRef arg)Add COS(arg) to the expressionTcos(ExpNode arg)Add COS(arg) to the expressionTdiv()Add / to the expressionTeq()Add an equals '=' node to the expressionTeq(int literalValue)Add '= {literalValue}' to the expressionTeq(long literalValue)Add '= {literalValue}' to the expressionTeq(java.lang.String columnExpression)Add '= {columnExpression}' to the expressionTeq(java.lang.String tableAlias, java.lang.String columnExpression)Add '= {tableAlias}.{columnExpression}' to the expressionTeq(ColumnRef ref)Add '= {ref}' to the expressionTeq(LiteralString str)Add '= {str}' to the expressionTeq(BindMarkerNode bindMarker)Add a bind marker and value to the expressionTescape()Add ESCAPE to the expressionTescape(java.lang.String str)Add ESCAPE {str} to the expressionTescape(java.lang.String tableAlias, java.lang.String columnExpression)Add ESCAPE {tableAlias}.{columnExpression} to the expressionTescape(ColumnRef ref)Add ESCAPE {ref} to the expressionTescape(BindMarkerNode bindMarker)Add ESCAPE ? to the expressionTexists(Select correlatedSubSelect)Add an exists clause using the given correlated sub-select statementTfilter(ExpNode filter)Add the expression directly without any other operatorExpNodegetExpression()Get the expression that has been builtprotected PredicateParsergetPredicateParser()Getter for the predicate parserprotected abstract TgetThis()Returns the sub-class type-specific instance of the class.Tgt()Add > to the expressionTgt(int literalValue)Add > {literalValue} to the expressionTgt(long literalValue)Add > {literalValue} to the expressionTgt(java.lang.String literalValue)Add > {literalValue} to the expressionTgt(ColumnRef ref)Add > {ref} to the expressionTgt(BindMarkerNode bindMarker)Add a bind marker and its value to the expressionTgte()Add >= to the expressionTgte(int literalValue)Add >= {literalValue} to the expressionTgte(long literalValue)Add >= {literalValue} to the expressionTgte(java.lang.String literalValue)Add >= {literalValue} to the expressionTgte(ColumnRef ref)Add >= {ref} to the expressionTgte(BindMarkerNode bindMarker)Add >= {bindMarker} to the expressionTin(java.lang.Long[] inList)Add IN (?, ?, ...) for a list of Long valuesTin(java.lang.String[] inList)Add IN (?, ?, ...) for a list of String valuesTin(java.util.List<java.lang.String> inList)Thanks to type erasure we can only have one type of list here.TinLiteral(java.lang.Long[] inList)Add IN (123, 124, ...) for a literal list of Long valuesTinLiteralLong(java.util.List<java.lang.Long> inList)Add IN (123, 124, ...) for a literal list of Long valuesTisNotNull()Add an IS NOT NULL operator to the expressionTisNull()Add an IS NULL operator to the expressionTleftParen()Add a left paren(to the expressionTlike()Add LIKE to the expressionTlike(java.lang.String str)Add LIKE {str} to the expressionTlike(java.lang.String tableAlias, java.lang.String columnExpression)Add LIKE {tableAlias}.{columnExpression} to the expressionTlike(ColumnRef ref)Add LIKE {ref} to the expressionTlike(BindMarkerNode bindMarker)Add LIKE ? to the expressionTliteral(double value)Add a literal double value to the expressionTliteral(long value)Add a literal long value to the expressionTliteral(java.lang.String value)Add a literal String value to the expressionTlt()Add < to the expressionTlt(int literalValue)Add < {literalValue} to the expressionTlt(long literalValue)Add < {literalValue} to the expressionTlt(java.lang.String literalValue)Add < {literalValue} to the expressionTlt(ColumnRef ref)Add < {ref} to the expressionTlt(BindMarkerNode bindMarker)Add < {bindMarker} to the expressionTlte()Add <= to the expressionTlte(int literalValue)Add <= {literalValue} to the expressionTlte(long literalValue)Add <= {literalValue} to the expressionTlte(java.lang.String literalValue)Add <= {literalValue} to the expressionTlte(ColumnRef ref)Add <= ref to the expressionTlte(BindMarkerNode bindMarker)Add <= {bindMarker} to the expressionTmult()Add * to the expressionTneq()Add != to the expressionTneq(int literalValue)Add != {literalValue} to the expressionTneq(long literalValue)Add != {literalValue} to the expressionTneq(java.lang.String literalValue)Add != {literalValue} to the expressionTneq(ColumnRef ref)Add != {ref} to the expressionTneq(LiteralString str)Add != {str} to the expressionTneq(BindMarkerNode bindMarker)Add a bind marker and its value to the expressionTnot(ExpNode expr)Add NOT to the expressionTnotExists(Select correlatedSubSelect)Add a NOT EXISTS clause using the given correlated sub-select statementToperator(Operator op)Add the operator op to the expressionTor()Add OR to the expressionTor(java.lang.String element)Add OR {element} to the expression where element is typically a column nameTor(java.lang.String tableAlias, java.lang.String columnName)Add OR {tableAlias}.{columnName} to the expressionTor(ColumnRef ref)Add OR {ref} to the expressionTor(ExpNode predicate)Add OR {predicate} to the expressionTradians(ColumnRef arg)Add RADIANS(arg) to the expressionTradians(ExpNode arg)Add RADIANS(arg) to the expressionTrightParen()Add a right paren)to the expressionTsin(ColumnRef arg)Add SIN(arg) to the expressionTsin(ExpNode arg)Add SIN(arg) to the expressionTsub()Add - to the expressionTwhere(java.lang.String columnName)To simplify code, support multiple where clauses, treating each as an ANDTwhere(java.lang.String tableAlias, java.lang.String columnName)To simplify code, support multiple where clauses, treating each as an AND
 
- 
- 
- 
Constructor Detail- 
BaseWhereAdapterprotected BaseWhereAdapter() For building standalone predicates like filters
 - 
BaseWhereAdapterprotected BaseWhereAdapter(PredicateParser pp) Adopts an existing predicate parser- Parameters:
- pp-
 
 
- 
 - 
Method Detail- 
getThisprotected abstract T getThis() Returns the sub-class type-specific instance of the class. Used as the return value in fluent methods.- Returns:
 
 - 
getPredicateParserprotected PredicateParser getPredicateParser() Getter for the predicate parser- Returns:
 
 - 
getExpressionpublic ExpNode getExpression() Get the expression that has been built- Returns:
 
 - 
literalpublic T literal(java.lang.String value) Add a literal String value to the expression- Parameters:
- value-
- Returns:
 
 - 
literalpublic T literal(long value) Add a literal long value to the expression- Parameters:
- value-
- Returns:
 
 - 
literalpublic T literal(double value) Add a literal double value to the expression- Parameters:
- value-
- Returns:
 
 - 
eqpublic T eq() Add an equals '=' node to the expression- Returns:
 
 - 
eqpublic T eq(long literalValue) Add '= {literalValue}' to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
eqpublic T eq(int literalValue) Add '= {literalValue}' to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
eqpublic T eq(java.lang.String columnExpression) Add '= {columnExpression}' to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
eqpublic T eq(LiteralString str) Add '= {str}' to the expression- Parameters:
- str-
- Returns:
 
 - 
eqpublic T eq(java.lang.String tableAlias, java.lang.String columnExpression) Add '= {tableAlias}.{columnExpression}' to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
eqpublic T eq(BindMarkerNode bindMarker) Add a bind marker and value to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
wherepublic T where(java.lang.String columnName) To simplify code, support multiple where clauses, treating each as an AND- Parameters:
- columnName-
- Returns:
 
 - 
wherepublic 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:
 
 - 
andpublic T and() Add an AND to the list of expression tokens- Returns:
 
 - 
andpublic T and(ExpNode predicate) Add AND {predicate} to the expression- Parameters:
- predicate-
- Returns:
 
 - 
andpublic T and(java.lang.String element) Add AND {element} to the expression where {element} is typically a simple column name
 - 
andpublic T and(java.lang.String tableAlias, java.lang.String columnName) Add AND {tableAlias}.{columnName} to the expression- Parameters:
- tableAlias-
- columnName-
- Returns:
 
 - 
andpublic T and(ColumnRef ref) Add AND {ref} to the expression- Parameters:
- ref- the column reference
- Returns:
 
 - 
orpublic T or() Add OR to the expression- Returns:
 
 - 
orpublic T or(ExpNode predicate) Add OR {predicate} to the expression- Parameters:
- predicate-
- Returns:
 
 - 
orpublic T or(java.lang.String element) Add OR {element} to the expression where element is typically a column name- Parameters:
- element-
- Returns:
 
 - 
orpublic T or(java.lang.String tableAlias, java.lang.String columnName) Add OR {tableAlias}.{columnName} to the expression- Parameters:
- tableAlias-
- columnName-
- Returns:
 
 - 
orpublic T or(ColumnRef ref) Add OR {ref} to the expression- Parameters:
- ref- the column reference
- Returns:
 
 - 
neqpublic T neq() Add != to the expression- Returns:
 
 - 
neqpublic T neq(ColumnRef ref) Add != {ref} to the expression- Parameters:
- ref- the column reference
- Returns:
 
 - 
neqpublic T neq(long literalValue) Add != {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
neqpublic T neq(int literalValue) Add != {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
neqpublic T neq(java.lang.String literalValue) Add != {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
neqpublic T neq(LiteralString str) Add != {str} to the expression- Parameters:
- str- a literal string value
- Returns:
 
 - 
neqpublic T neq(BindMarkerNode bindMarker) Add a bind marker and its value to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
gtpublic T gt() Add > to the expression- Returns:
 
 - 
gtpublic T gt(ColumnRef ref) Add > {ref} to the expression- Parameters:
- ref- the column reference
- Returns:
 
 - 
gtpublic T gt(long literalValue) Add > {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
gtpublic T gt(int literalValue) Add > {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
gtpublic T gt(java.lang.String literalValue) Add > {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
gtpublic T gt(BindMarkerNode bindMarker) Add a bind marker and its value to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
gtepublic T gte() Add >= to the expression- Returns:
 
 - 
gtepublic T gte(ColumnRef ref) Add >= {ref} to the expression- Parameters:
- ref- the column reference
- Returns:
 
 - 
gtepublic T gte(long literalValue) Add >= {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
gtepublic T gte(int literalValue) Add >= {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
gtepublic T gte(java.lang.String literalValue) Add >= {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
gtepublic T gte(BindMarkerNode bindMarker) Add >= {bindMarker} to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
ltpublic T lt() Add < to the expression- Returns:
 
 - 
ltpublic T lt(ColumnRef ref) Add < {ref} to the expression- Parameters:
- ref- the column reference
- Returns:
 
 - 
ltpublic T lt(long literalValue) Add < {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
ltpublic T lt(int literalValue) Add < {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
ltpublic T lt(java.lang.String literalValue) Add < {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
ltpublic T lt(BindMarkerNode bindMarker) Add < {bindMarker} to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
ltepublic T lte() Add <= to the expression- Returns:
 
 - 
ltepublic T lte(long literalValue) Add <= {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
ltepublic T lte(int literalValue) Add <= {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
ltepublic T lte(java.lang.String literalValue) Add <= {literalValue} to the expression- Parameters:
- literalValue-
- Returns:
 
 - 
ltepublic T lte(BindMarkerNode bindMarker) Add <= {bindMarker} to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
colpublic T col(java.lang.String expression) Add a column expression or reference- Parameters:
- expression-
- Returns:
 
 - 
colpublic T col(java.lang.String tableAlias, java.lang.String expression) Add the qualified name {tableAlias}.{expression} to the expression- Parameters:
- tableAlias-
- expression-
- Returns:
 
 - 
existspublic T exists(Select correlatedSubSelect) Add an exists clause using the given correlated sub-select statement- Parameters:
- correlatedSubSelect-
- Returns:
 
 - 
notExistspublic T notExists(Select correlatedSubSelect) Add a NOT EXISTS clause using the given correlated sub-select statement- Parameters:
- correlatedSubSelect-
- Returns:
 
 - 
multpublic T mult() Add * to the expression- Returns:
 
 - 
addpublic T add() Add + to the expression- Returns:
 
 - 
subpublic T sub() Add - to the expression- Returns:
 
 - 
divpublic T div() Add / to the expression- Returns:
 
 - 
coalescepublic 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:
 
 - 
radianspublic T radians(ExpNode arg) Add RADIANS(arg) to the expression- Parameters:
- arg-
- Returns:
 
 - 
radianspublic T radians(ColumnRef arg) Add RADIANS(arg) to the expression- Parameters:
- arg-
- Returns:
 
 - 
isNotNullpublic T isNotNull() Add an IS NOT NULL operator to the expression- Returns:
 
 - 
isNullpublic T isNull() Add an IS NULL operator to the expression- Returns:
 
 - 
leftParenpublic T leftParen() Add a left paren(to the expression
 - 
rightParenpublic T rightParen() Add a right paren)to the expression
 - 
inpublic T in(java.lang.String[] inList) Add IN (?, ?, ...) for a list of String values- Parameters:
- inList-
- Returns:
 
 - 
inpublic 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:
 
 - 
inpublic T in(java.lang.Long[] inList) Add IN (?, ?, ...) for a list of Long values- Parameters:
- inList-
- Returns:
 
 - 
inLiteralpublic T inLiteral(java.lang.Long[] inList) Add IN (123, 124, ...) for a literal list of Long values- Parameters:
- inList-
- Returns:
 
 - 
inLiteralLongpublic T inLiteralLong(java.util.List<java.lang.Long> inList) Add IN (123, 124, ...) for a literal list of Long values- Parameters:
- inList-
- Returns:
 
 - 
likepublic T like() Add LIKE to the expression- Returns:
 
 - 
likepublic T like(java.lang.String str) Add LIKE {str} to the expression- Parameters:
- str-
- Returns:
 
 - 
likepublic T like(java.lang.String tableAlias, java.lang.String columnExpression) Add LIKE {tableAlias}.{columnExpression} to the expression- Parameters:
- tableAlias-
- columnExpression-
- Returns:
 
 - 
likepublic T like(BindMarkerNode bindMarker) Add LIKE ? to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
escapepublic T escape() Add ESCAPE to the expression- Returns:
 
 - 
escapepublic T escape(ColumnRef ref) Add ESCAPE {ref} to the expression- Parameters:
- ref-
- Returns:
 
 - 
escapepublic T escape(java.lang.String str) Add ESCAPE {str} to the expression- Parameters:
- str-
- Returns:
 
 - 
escapepublic T escape(java.lang.String tableAlias, java.lang.String columnExpression) Add ESCAPE {tableAlias}.{columnExpression} to the expression- Parameters:
- tableAlias-
- columnExpression-
- Returns:
 
 - 
escapepublic T escape(BindMarkerNode bindMarker) Add ESCAPE ? to the expression- Parameters:
- bindMarker-
- Returns:
 
 - 
filterpublic T filter(ExpNode filter) Add the expression directly without any other operator- Parameters:
- filter-
- Returns:
 
 - 
bindpublic T bind(java.lang.String param) Add a bind marker and its string value to the expression. Handles null.- Parameters:
- param-
- Returns:
 
 - 
bindpublic T bind(java.lang.Long param) Add a bind marker and Long value to the expression. Handles null.- Parameters:
- param-
- Returns:
 
 - 
bindpublic T bind(java.lang.Integer param) Add a bind marker and Integer value to the expression. Handles null.- Parameters:
- param-
- Returns:
 
 - 
bindpublic T bind(java.lang.Double param) Add a bind marker and Double value to the expression. Handles null.- Parameters:
- param-
- Returns:
 
 - 
bindpublic T bind(java.time.Instant param) Add a bind marker and Instant value to the expression. Handles null.- Parameters:
- param-
- Returns:
 
 - 
bindpublic T bind(java.math.BigDecimal value) Add a bind marker and BigDecimal value to the expression. Handles null.- Parameters:
- param-
- Returns:
 
 
- 
 
-