FeaturesPluginsDocs & SupportCommunityPartners

org.netbeans.modules.jackpot/2 2 1

org.netbeans.api.jackpot
Class TreePathTransformer<R,P>

java.lang.Object
  extended by com.sun.source.util.TreeScanner<R,P>
      extended by com.sun.source.util.TreePathScanner<R,P>
          extended by org.netbeans.api.java.source.support.CancellableTreePathScanner<R,P>
              extended by org.netbeans.api.jackpot.TreePathQuery<R,P>
                  extended by 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.


Constructor Summary
TreePathTransformer()
          Creates a new instance of TreePathTransformer
 
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.TreePathScanner
getCurrentPath, 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
 
Methods inherited from interface org.netbeans.api.jackpot.Query
attach, cancel, destroy, getCompilationInfo, getJavaSource, init, release, run
 

Constructor Detail

TreePathTransformer

public TreePathTransformer()
Creates a new instance of TreePathTransformer

Method Detail

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 query
newTree - 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 query
newTree - the replacement for the tree path's leaf node
note - 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

org.netbeans.modules.jackpot/2 2 1

Built on April 6 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by