Class StringExpNodeVisitor
- java.lang.Object
-
- com.ibm.fhir.database.utils.query.expression.StringExpNodeVisitor
-
- All Implemented Interfaces:
ExpNodeVisitor<String>
- Direct Known Subclasses:
DebugExpNodeVisitor
public class StringExpNodeVisitor extends Object implements ExpNodeVisitor<String>
Renders the expression node tree into a string
-
-
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, List<BindMarkerNode> collectBindMarkersInto, boolean pretty)
Collect the bind marker values into the given list
-
Method Summary
-
-
-
Field Detail
-
NEWLINE
public static final String NEWLINE
-
-
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, List<BindMarkerNode> collectBindMarkersInto, boolean pretty)
Collect the bind marker values into the given list- Parameters:
translator
-collectBindMarkersInto
-
-
-
Method Detail
-
stringify
public static String stringify(ExpNode exp)
Helper to render an expression as a string using this class as a visitor- Parameters:
exp
-- Returns:
-
paren
public String paren(String expr)
- Specified by:
paren
in interfaceExpNodeVisitor<String>
-
and
public String and(String left, String right)
- Specified by:
and
in interfaceExpNodeVisitor<String>
-
or
public String or(String left, String right)
- Specified by:
or
in interfaceExpNodeVisitor<String>
-
not
public String not(String exp)
- Specified by:
not
in interfaceExpNodeVisitor<String>
-
exists
public String exists(String selectString)
- Specified by:
exists
in interfaceExpNodeVisitor<String>
-
notExists
public String notExists(String selectString)
- Specified by:
notExists
in interfaceExpNodeVisitor<String>
-
eq
public String eq(String left, String right)
- Specified by:
eq
in interfaceExpNodeVisitor<String>
-
neq
public String neq(String left, String right)
- Specified by:
neq
in interfaceExpNodeVisitor<String>
-
gt
public String gt(String left, String right)
- Specified by:
gt
in interfaceExpNodeVisitor<String>
-
gte
public String gte(String left, String right)
- Specified by:
gte
in interfaceExpNodeVisitor<String>
-
lt
public String lt(String left, String right)
- Specified by:
lt
in interfaceExpNodeVisitor<String>
-
lte
public String lte(String left, String right)
- Specified by:
lte
in interfaceExpNodeVisitor<String>
-
literal
public String literal(String value)
- Specified by:
literal
in interfaceExpNodeVisitor<String>
-
literal
public String literal(Long value)
- Specified by:
literal
in interfaceExpNodeVisitor<String>
-
literal
public String literal(Double value)
- Specified by:
literal
in interfaceExpNodeVisitor<String>
-
add
public String add(String left, String right)
- Specified by:
add
in interfaceExpNodeVisitor<String>
-
subtract
public String subtract(String left, String right)
- Specified by:
subtract
in interfaceExpNodeVisitor<String>
-
multiply
public String multiply(String left, String right)
- Specified by:
multiply
in interfaceExpNodeVisitor<String>
-
divide
public String divide(String left, String right)
- Specified by:
divide
in interfaceExpNodeVisitor<String>
-
isNull
public String isNull(String expr)
- Specified by:
isNull
in interfaceExpNodeVisitor<String>
-
isNotNull
public String isNotNull(String expr)
- Specified by:
isNotNull
in interfaceExpNodeVisitor<String>
-
between
public String between(String leftValue, String rightValue)
- Specified by:
between
in interfaceExpNodeVisitor<String>
-
column
public String column(String tableAlias, String columnName)
- Specified by:
column
in interfaceExpNodeVisitor<String>
-
bindMarker
public String bindMarker(Double value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<String>
-
bindMarker
public String bindMarker(Long value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<String>
-
bindMarker
public String bindMarker(String value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<String>
-
bindMarker
public String bindMarker(Instant value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<String>
-
bindMarker
public String bindMarker(Integer value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<String>
-
in
public String in(String left, List<String> args)
- Specified by:
in
in interfaceExpNodeVisitor<String>
-
like
public String like(String left, String right)
- Specified by:
like
in interfaceExpNodeVisitor<String>
-
escape
public String escape(String left, String right)
- Specified by:
escape
in interfaceExpNodeVisitor<String>
-
select
public String select(Select select)
Description copied from interface:ExpNodeVisitor
Process a sub-select statement- Specified by:
select
in interfaceExpNodeVisitor<String>
- Returns:
-
coalesce
public String coalesce(List<ColumnRef> columnRefs)
Description copied from interface:ExpNodeVisitor
Render a COALESCE(...) function- Specified by:
coalesce
in interfaceExpNodeVisitor<String>
- Returns:
-
bindMarker
public String bindMarker(BigDecimal value)
- Specified by:
bindMarker
in interfaceExpNodeVisitor<String>
-
cos
public String cos(String arg)
Description copied from interface:ExpNodeVisitor
SQL COS function- Specified by:
cos
in interfaceExpNodeVisitor<String>
- Returns:
-
acos
public String acos(String arg)
Description copied from interface:ExpNodeVisitor
SQL ACOS function- Specified by:
acos
in interfaceExpNodeVisitor<String>
- Returns:
-
sin
public String sin(String arg)
Description copied from interface:ExpNodeVisitor
SQL SIN function- Specified by:
sin
in interfaceExpNodeVisitor<String>
- Returns:
-
-