org.netbeans.api.jackpot
Class TreePathTransformer<R,P>
java.lang.Object
com.sun.source.util.TreeScanner <R,P>
com.sun.source.util.TreePathScanner <R,P>
org.netbeans.api.java.source.support.CancellableTreePathScanner<R,P>
org.netbeans.api.jackpot.TreePathQuery <R,P>
org.netbeans.api.jackpot.TreePathTransformer<R,P>
All Implemented Interfaces: TreeVisitor <R,P>, Query , Transformer
public abstract class TreePathTransformer<R,P> extends TreePathQuery <R,P>implements Transformer
An abstract Transformer which extends TreePathScanner to visit the project's
AST nodes using the visitor pattern.
Method Summary
void
addChange (TreePath path,
Tree newTree)
Forward a change (query match and replacement) to the transformer's context.
void
addChange (TreePath path,
Tree newTree,
String note)
Forward a change (query match and replacement) to the transformer's context,
along with a note describing the change.
List <String >
getFailures ()
Returns the list of translation failures reported by the transformer,
which is normally empty.
org.netbeans.api.java.source.WorkingCopy
getWorkingCopy ()
Returns the WorkingCopy attached to this transformation.
boolean
hasFailures ()
Returns whether there were any translation failures reported by the
transformer.
void
transformationFailure (String message)
Called by a transformer when it discovers code it cannot transform, such
as an unmapped method when converting one class to another.
Methods inherited from class org.netbeans.api.jackpot.TreePathQuery
addResult , addResult , addResult , attach , destroy , getCompilationInfo , getContext , getJavaSource , init , release , run
Methods inherited from class org.netbeans.api.java.source.support.CancellableTreePathScanner
cancel, isCanceled, scan, scan
Methods inherited from class com.sun.source.util.TreeScanner
reduce , visitAnnotation , visitArrayAccess , visitArrayType , visitAssert , visitAssignment , visitBinary , visitBlock , visitBreak , visitCase , visitCatch , visitClass , visitCompilationUnit , visitCompoundAssignment , visitConditionalExpression , visitContinue , visitDoWhileLoop , visitEmptyStatement , visitEnhancedForLoop , visitErroneous , visitExpressionStatement , visitForLoop , visitIdentifier , visitIf , visitImport , visitInstanceOf , visitLabeledStatement , visitLiteral , visitMemberSelect , visitMethod , visitMethodInvocation , visitModifiers , visitNewArray , visitNewClass , visitOther , visitParameterizedType , visitParenthesized , visitPrimitiveType , visitReturn , visitSwitch , visitSynchronized , visitThrow , visitTry , visitTypeCast , visitTypeParameter , visitUnary , visitVariable , visitWhileLoop , visitWildcard
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
TreePathTransformer
public TreePathTransformer ()
Creates a new instance of TreePathTransformer
addChange
public final void addChange (TreePath path,
Tree newTree)
Forward a change (query match and replacement) to the transformer's context.
Parameters: path - the path of the tree that matched the querynewTree - the replacement for the tree path's leaf node
addChange
public final void addChange (TreePath path,
Tree newTree,
String note)
Forward a change (query match and replacement) to the transformer's context,
along with a note describing the change.
Parameters: path - the path of the tree that matched the querynewTree - the replacement for the tree path's leaf nodenote - optional information about the match, or
null if there is no note.
transformationFailure
public final void transformationFailure (String message)
Description copied from interface: Transformer
Called by a transformer when it discovers code it cannot transform, such
as an unmapped method when converting one class to another. This is
different than QueryException, which is thrown when the query or
transformer cannot continue.
Specified by: transformationFailure in interface Transformer
Parameters: message - a description of the translation failure.
getWorkingCopy
public final org.netbeans.api.java.source.WorkingCopy getWorkingCopy ()
Description copied from interface: Transformer
Returns the WorkingCopy attached to this transformation.
Specified by: getWorkingCopy in interface Transformer
Returns: the WorkingCopy instance, or null if not attached.
hasFailures
public final boolean hasFailures ()
Returns whether there were any translation failures reported by the
transformer.
Returns: true if any failures were reported
getFailures
public final List <String > getFailures ()
Returns the list of translation failures reported by the transformer,
which is normally empty.
Returns: the list of failure messages
Login form requires Javascript