Package spoon.support.compiler
Class SnippetCompilationHelper
java.lang.Object
spoon.support.compiler.SnippetCompilationHelper
Helper class for working with snippets
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcompileAndReplaceSnippetsIn(CtType<?> initialClass)Takes the class given as parameter, pretty-prints it, get the JDT'ast and the corrspondong Spoon AST and finally replace all children of initialClass by the the fresh ones.static <T> CtExpression<T>compileExpression(CtCodeSnippetExpression<T> expr)static CtStatementstatic CtStatementcompileStatement(CtCodeSnippetStatement st, CtTypeReference returnType)
-
Method Details
-
compileAndReplaceSnippetsIn
Takes the class given as parameter, pretty-prints it, get the JDT'ast and the corrspondong Spoon AST and finally replace all children of initialClass by the the fresh ones. This results that all snippets are now full-fledged ASTs. -
compileStatement
public static CtStatement compileStatement(CtCodeSnippetStatement st) throws SnippetCompilationError- Throws:
SnippetCompilationError
-
compileStatement
public static CtStatement compileStatement(CtCodeSnippetStatement st, CtTypeReference returnType) throws SnippetCompilationError- Throws:
SnippetCompilationError
-
compileExpression
public static <T> CtExpression<T> compileExpression(CtCodeSnippetExpression<T> expr) throws SnippetCompilationError- Throws:
SnippetCompilationError
-