站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 3.2.4 正式版 API 英文文档

ASTPrinter (Hibernate API Documentation) - Hibernate 3.2.4 正式版 API 英文文档


org.hibernate.hql.ast.util
Class ASTPrinter

java.lang.Object
  extended byorg.hibernate.hql.ast.util.ASTPrinter

public class ASTPrinter
extends Object

An 'ASCII art' AST printer for debugging ANTLR grammars.

Author:
Joshua Davis (pgmjsd@sourceforge.net)

Constructor Summary
ASTPrinter(Class tokenTypeConstants)
          Constructs an org.hibernate.hql.antlr.ASTPrinter, given the class that contains the token type constants (typically the '{grammar}TokenTypes' interface generated by ANTLR).
 
Method Summary
static void appendEscapedMultibyteChars(String text, StringBuffer buf)
           
static String escapeMultibyteChars(String text)
           
static String getConstantName(Class tokenTypeConstants, int type)
          Get a single token type name in the specified set of token type constants (interface).
 boolean isShowClassNames()
          Returns true if the node class names will be displayed.
 String nodeToString(antlr.collections.AST ast, boolean showClassName)
           
 void setShowClassNames(boolean showClassNames)
          Enables or disables AST node class name display.
 String showAsString(antlr.collections.AST ast, String header)
          Prints the AST in 'ASCII art' tree form into a string.
 void showAst(antlr.collections.AST ast, PrintWriter pw)
          Prints the AST in 'ASCII art' tree form to the specified print writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASTPrinter

public ASTPrinter(Class tokenTypeConstants)
Constructs an org.hibernate.hql.antlr.ASTPrinter, given the class that contains the token type constants (typically the '{grammar}TokenTypes' interface generated by ANTLR).

Parameters:
tokenTypeConstants - The class with token type constants in it.
Method Detail

isShowClassNames

public boolean isShowClassNames()
Returns true if the node class names will be displayed.

Returns:
true if the node class names will be displayed.

setShowClassNames

public void setShowClassNames(boolean showClassNames)
Enables or disables AST node class name display.

Parameters:
showClassNames - true to enable class name display, false to disable

showAst

public void showAst(antlr.collections.AST ast,
                    PrintWriter pw)
Prints the AST in 'ASCII art' tree form to the specified print writer.

Parameters:
ast - The AST to print.
pw - The print writer.

showAsString

public String showAsString(antlr.collections.AST ast,
                           String header)
Prints the AST in 'ASCII art' tree form into a string.

Parameters:
ast - The AST to display.
header - The header for the display.
Returns:
The AST in 'ASCII art' form, as a string.

getConstantName

public static String getConstantName(Class tokenTypeConstants,
                                     int type)
Get a single token type name in the specified set of token type constants (interface).

Parameters:
tokenTypeConstants - Token type constants interface (e.g. HqlSqlTokenTypes.class).
type - The token type ( typically from ast.getType() ).
Returns:
The token type name, *or* the integer value if the name could not be found for some reason.

nodeToString

public String nodeToString(antlr.collections.AST ast,
                           boolean showClassName)

appendEscapedMultibyteChars

public static void appendEscapedMultibyteChars(String text,
                                               StringBuffer buf)

escapeMultibyteChars

public static String escapeMultibyteChars(String text)