Class StringExpNodeVisitor
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.query.expression.StringExpNodeVisitor
-
- All Implemented Interfaces:
ExpNodeVisitor<java.lang.String>
- Direct Known Subclasses:
DebugExpNodeVisitor
public class StringExpNodeVisitor extends java.lang.Object implements ExpNodeVisitor<java.lang.String>
Renders the expression node tree into a string
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NEWLINE
-
Constructor Summary
Constructors Constructor Description StringExpNodeVisitor()
Simple rendering of the expression tree to a string, ignoring the bind marker valuesStringExpNodeVisitor(boolean pretty)
For rendering the expression tree to a string with additional formatting to improve readability.StringExpNodeVisitor(IDatabaseTranslator translator, java.util.List<BindMarkerNode> collectBindMarkersInto, boolean pretty)
Collect the bind marker values into the given list
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
acos(java.lang.String arg)
SQL ACOS functionjava.lang.String
add(java.lang.String left, java.lang.String right)
java.lang.String
and(java.lang.String left, java.lang.String right)
java.lang.String
between(java.lang.String leftValue, java.lang.String rightValue)
java.lang.String
bindMarker(java.lang.Double value)
java.lang.String
bindMarker(java.lang.Integer value)
java.lang.String
bindMarker(java.lang.Long value)
java.lang.String
bindMarker(java.lang.String value)
java.lang.String
bindMarker(java.math.BigDecimal value)
java.lang.String
bindMarker(java.time.Instant value)
java.lang.String
coalesce(java.util.List<ColumnRef> columnRefs)
Render a COALESCE(...) functionjava.lang.String
column(java.lang.String tableAlias, java.lang.String columnName)
java.lang.String
cos(java.lang.String arg)
SQL COS functionjava.lang.String
divide(java.lang.String left, java.lang.String right)
java.lang.String
eq(java.lang.String left, java.lang.String right)
java.lang.String
escape(java.lang.String left, java.lang.String right)
java.lang.String
exists(java.lang.String selectString)
java.lang.String
gt(java.lang.String left, java.lang.String right)
java.lang.String
gte(java.lang.String left, java.lang.String right)
java.lang.String
in(java.lang.String left, java.util.List<java.lang.String> args)
java.lang.String
isNotNull(java.lang.String expr)
java.lang.String
isNull(java.lang.String expr)
java.lang.String
like(java.lang.String left, java.lang.String right)
java.lang.String
literal(java.lang.Double value)
java.lang.String
literal(java.lang.Long value)
java.lang.String
literal(java.lang.String value)
java.lang.String
lt(java.lang.String left, java.lang.String right)
java.lang.String
lte(java.lang.String left, java.lang.String right)
java.lang.String
multiply(java.lang.String left, java.lang.String right)
java.lang.String
neq(java.lang.String left, java.lang.String right)
java.lang.String
not(java.lang.String exp)
java.lang.String
notExists(java.lang.String selectString)
java.lang.String
or(java.lang.String left, java.lang.String right)
java.lang.String
paren(java.lang.String expr)
java.lang.String
radians(java.lang.String arg)
SQL RADIANS functionjava.lang.String
select(Select select)
Process a sub-select statementjava.lang.String
sin(java.lang.String arg)
SQL SIN functionstatic java.lang.String
stringify(ExpNode exp)
Helper to render an expression as a string using this class as a visitorjava.lang.String
subtract(java.lang.String left, java.lang.String right)
-
-
-
Constructor Detail
-
StringExpNodeVisitor
public StringExpNodeVisitor()
Simple rendering of the expression tree to a string, ignoring the bind marker values
-
StringExpNodeVisitor
public StringExpNodeVisitor(boolean pretty)
For rendering the expression tree to a string with additional formatting to improve readability.- Parameters:
pretty
-
-
StringExpNodeVisitor
public StringExpNodeVisitor(IDatabaseTranslator translator, java.util.List<BindMarkerNode> collectBindMarkersInto, boolean pretty)
Collect the bind marker values into the given list- Parameters:
translator
-collectBindMarkersInto
-
-
-
Method Detail
-
stringify
public static java.lang.String stringify(ExpNode exp)
Helper to render an expression as a string using this class as a visitor- Parameters:
exp
-- Returns:
-
paren
public java.lang.String paren(java.lang.String expr)
- Specified by:
paren
in interfaceExpNodeVisitor<java.lang.String>
-
and
public java.lang.String and(java.lang.String left, java.lang.String right)
- Specified by:
and
in interfaceExpNodeVisitor<java.lang.String>
-
or
public java.lang.String or(java.lang.String left, java.lang.String right)
- Specified by:
or
in interfaceExpNodeVisitor<java.lang.String>
-
not
public java.lang.String not(java.lang.String exp)
- Specified by:
not
in interfaceExpNodeVisitor<java.lang.String>
-
exists
public java.lang.String exists(java.lang.String selectString)
- Specified by:
exists
in interfaceExpNodeVisitor<java.lang.String>
-
notExists
public java.lang.String notExists(java.lang.String selectString)
- Specified by:
notExists
in interfaceExpNodeVisitor<java.lang.String>
-
eq
public java.lang.String eq(java.lang.String left, java.lang.String right)
- Specified by:
eq
in interfaceExpNodeVisitor<java.lang.String>
-
neq
public java.lang.String neq(java.lang.String left, java.lang.String right)
- Specified by:
neq
in interfaceExpNodeVisitor<java.lang.String>
-
gt
public java.lang.String gt(java.lang.String left, java.lang.String right)
- Specified by:
gt
in interfaceExpNodeVisitor<java.lang.String>
-
gte
public java.lang.String gte(java.lang.String left, java.lang.String right)
- Specified by:
gte
in interfaceExpNodeVisitor<java.lang.String>
-
lt
public java.lang.String lt(java.lang.String left, java.lang.String right)
- Specified by:
lt
in interfaceExpNodeVisitor<java.lang.String>
-
lte
public java.lang.String lte(java.lang.String left, java.lang.String right)
- Specified by:
lte
in interfaceExpNodeVisitor<java.lang.String>
-
literal
public java.lang.String literal(java.lang.String value)
- Specified by:
literal
in interfaceExpNodeVisitor<java.lang.String>
-
literal
public java.lang.String literal(java.lang.Long value)
- Specified by:
literal
in interfaceExpNodeVisitor<java.lang.String>
-
literal
public java.lang.String literal(java.lang.Double value)
- Specified by:
literal
in interfaceExpNodeVisitor<java.lang.String>
-
add
public java.lang.String add(java.lang.String left, java.lang.String right)
- Specified by:
add
in interfaceExpNodeVisitor<java.lang.String>
-
subtract
public java.lang.String subtract(java.lang.String left, java.lang.String right)
- Specified by:
subtract
in interfaceExpNodeVisitor<java.lang.String>
-
multiply
public java.lang.String multiply(java.lang.String left, java.lang.String right)
- Specified by:
multiply
in interfaceExpNodeVisitor<java.lang.String>
-
divide
public java.lang.String divide(java.lang.String left, java.lang.String right)
- Specified by:
divide
in interfaceExpNodeVisitor<java.lang.String>
-
isNull
public java.lang.String isNull(java.lang.String expr)
- Specified by:
isNull
in interfaceExpNodeVisitor<java.lang.String>
-
isNotNull
public java.lang.String isNotNull(java.lang.String expr)
- Specified by:
isNotNull
in interfaceExpNodeVisitor<java.lang.String>
-
between
public java.lang.String between(java.lang.String leftValue, java.lang.String rightValue)
- Specified by:
between
in interfaceExpNodeVisitor<java.lang.String>
-
column
public java.lang.String column(java.lang.String tableAlias, java.lang.String columnName)
- Specified by:
column
in interfaceExpNodeVisitor<java.lang.String>
-
bindMarker
public java.lang.String bindMarker(java.lang.Double value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<java.lang.String>
-
bindMarker
public java.lang.String bindMarker(java.lang.Long value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<java.lang.String>
-
bindMarker
public java.lang.String bindMarker(java.lang.String value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<java.lang.String>
-
bindMarker
public java.lang.String bindMarker(java.time.Instant value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<java.lang.String>
-
bindMarker
public java.lang.String bindMarker(java.lang.Integer value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<java.lang.String>
-
in
public java.lang.String in(java.lang.String left, java.util.List<java.lang.String> args)
- Specified by:
in
in interfaceExpNodeVisitor<java.lang.String>
-
like
public java.lang.String like(java.lang.String left, java.lang.String right)
- Specified by:
like
in interfaceExpNodeVisitor<java.lang.String>
-
escape
public java.lang.String escape(java.lang.String left, java.lang.String right)
- Specified by:
escape
in interfaceExpNodeVisitor<java.lang.String>
-
select
public java.lang.String select(Select select)
Description copied from interface:ExpNodeVisitor
Process a sub-select statement- Specified by:
select
in interfaceExpNodeVisitor<java.lang.String>
- Returns:
-
coalesce
public java.lang.String coalesce(java.util.List<ColumnRef> columnRefs)
Description copied from interface:ExpNodeVisitor
Render a COALESCE(...) function- Specified by:
coalesce
in interfaceExpNodeVisitor<java.lang.String>
- Returns:
-
bindMarker
public java.lang.String bindMarker(java.math.BigDecimal value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<java.lang.String>
-
cos
public java.lang.String cos(java.lang.String arg)
Description copied from interface:ExpNodeVisitor
SQL COS function- Specified by:
cos
in interfaceExpNodeVisitor<java.lang.String>
- Returns:
-
acos
public java.lang.String acos(java.lang.String arg)
Description copied from interface:ExpNodeVisitor
SQL ACOS function- Specified by:
acos
in interfaceExpNodeVisitor<java.lang.String>
- Returns:
-
sin
public java.lang.String sin(java.lang.String arg)
Description copied from interface:ExpNodeVisitor
SQL SIN function- Specified by:
sin
in interfaceExpNodeVisitor<java.lang.String>
- Returns:
-
radians
public java.lang.String radians(java.lang.String arg)
Description copied from interface:ExpNodeVisitor
SQL RADIANS function- Specified by:
radians
in interfaceExpNodeVisitor<java.lang.String>
- Returns:
-
-