Package org.apache.calcite.linq4j.tree
Class ExpressionWriter
- java.lang.Object
-
- org.apache.calcite.linq4j.tree.ExpressionWriter
-
class ExpressionWriter extends Object
Converts an expression to Java code.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classExpressionWriter.IndentHelps generate strings of spaces, to indent text.
-
Field Summary
Fields Modifier and Type Field Description private StringBuilderbufprivate booleangenericsprivate Stringindent(package private) static ExpressionWriter.IndentINDENTprivate booleanindentPendingprivate intlevel
-
Constructor Summary
Constructors Constructor Description ExpressionWriter()ExpressionWriter(boolean generics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressionWriterappend(char c)ExpressionWriterappend(Object o)ExpressionWriterappend(Type type)ExpressionWriterappend(String s)ExpressionWriterappend(AbstractNode o)voidbackUp()voidbegin()Increases the indentation level.ExpressionWriterbegin(String s)private voidcheckIndent()voidend()Decreases the indentation level.ExpressionWriterend(String s)StringBuildergetBuf()ExpressionWriterindent()ExpressionWriterlist(String begin, String sep, String end, Iterable<?> list)ExpressionWriternewlineAndIndent()booleanrequireParentheses(Expression expression, int lprec, int rprec)If parentheses are required, writes this expression out with parentheses and returns true.StringtoString()voidwrite(Node expression)
-
-
-
Field Detail
-
INDENT
static final ExpressionWriter.Indent INDENT
-
buf
private final StringBuilder buf
-
level
private int level
-
indent
private String indent
-
indentPending
private boolean indentPending
-
generics
private final boolean generics
-
-
Method Detail
-
write
public void write(Node expression)
-
requireParentheses
public boolean requireParentheses(Expression expression, int lprec, int rprec)
If parentheses are required, writes this expression out with parentheses and returns true. If they are not required, does nothing and returns false.
-
begin
public void begin()
Increases the indentation level.
-
end
public void end()
Decreases the indentation level.
-
newlineAndIndent
public ExpressionWriter newlineAndIndent()
-
indent
public ExpressionWriter indent()
-
begin
public ExpressionWriter begin(String s)
-
end
public ExpressionWriter end(String s)
-
append
public ExpressionWriter append(char c)
-
append
public ExpressionWriter append(Type type)
-
append
public ExpressionWriter append(AbstractNode o)
-
append
public ExpressionWriter append(Object o)
-
append
public ExpressionWriter append(String s)
-
checkIndent
private void checkIndent()
-
getBuf
public StringBuilder getBuf()
-
list
public ExpressionWriter list(String begin, String sep, String end, Iterable<?> list)
-
backUp
public void backUp()
-
-