Package org.codehaus.groovy.ast
Class AstToTextHelper
java.lang.Object
org.codehaus.groovy.ast.AstToTextHelper
Helper class for converting AST into text.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetClassText(ClassNode node) Rendersnodewithout generics.static StringgetModifiersText(int modifiers) Renders the modifier bits ofmodifiersas keywords, in this order: private, protected, public, static, abstract, final, interface, native, synchronized, transient, volatile.static StringgetParametersText(Parameter[] parameters) JoinsgetParameterText(org.codehaus.groovy.ast.Parameter)for each parameter with", ".static StringgetParameterText(Parameter node) Rendersnodeastype name, plus=and the initial expression when one is present.static StringgetThrowsClauseText(ClassNode[] exceptions) Renders a throws clause, including the leading space.
-
Constructor Details
-
AstToTextHelper
public AstToTextHelper()
-
-
Method Details
-
getClassText
Rendersnodewithout generics. A null node is rendered as <unknown>.- Parameters:
node- class to render, or null- Returns:
node.toString(false), or <unknown>
-
getParameterText
Rendersnodeastype name, plus=and the initial expression when one is present. A null parameter, or a parameter with a null name, uses <unknown> for that part.- Parameters:
node- parameter to render, or null- Returns:
- that declaration text
-
getParametersText
JoinsgetParameterText(org.codehaus.groovy.ast.Parameter)for each parameter with", ". A null or empty array is an empty string.- Parameters:
parameters- parameters to render, or null- Returns:
- the joined parameter list, without parentheses
-
getThrowsClauseText
Renders a throws clause, including the leading space. A null or empty array is an empty string.- Parameters:
exceptions- checked exception types, or null- Returns:
- a leading space,
throws, the joined type names, or empty
-
getModifiersText
Renders the modifier bits ofmodifiersas keywords, in this order: private, protected, public, static, abstract, final, interface, native, synchronized, transient, volatile. Bits outside that set are ignored.- Parameters:
modifiers- JVM access flags- Returns:
- the keywords separated by spaces, or empty when none apply
-