public class PackageRule extends TransformRule
TypeAnalyzer
traverses an AST. Those
actions rename the package that contains the given class.Red (tfeng) |
Red (tfeng) |
Constructor and Description |
---|
PackageRule() |
Modifier and Type | Method and Description |
---|---|
void |
afterTraverse(TypeAnalyzer analyzer,
org.eclipse.jdt.core.dom.CompilationUnit root)
Rename the occurance of package names after the AST is traversed.
|
void |
beforeTraverse(TypeAnalyzer analyzer,
org.eclipse.jdt.core.dom.CompilationUnit root)
Execute actions before the AST is traversed.
|
java.lang.String |
getPrefix()
Get the prefix to be added to the old package name.
|
void |
setPrefix(java.lang.String prefix)
Set the prefix to be added to the old package name.
|
public void afterTraverse(TypeAnalyzer analyzer, org.eclipse.jdt.core.dom.CompilationUnit root)
Due to the change of the package that the class belongs to, originally accessible classes in the same package may becomes inaccessable. This transformer explicitly imports those classes when necessary. Unfortunately, protected classes originally in the same package may not be imported, and protected members of other classes in that package are no longer accessible. It is the user's responsibility to ensure that those cases do not happen.
afterTraverse
in class TransformRule
analyzer
- The type analyzer.root
- The root of the AST.TransformRule.beforeTraverse(TypeAnalyzer, CompilationUnit)
public void beforeTraverse(TypeAnalyzer analyzer, org.eclipse.jdt.core.dom.CompilationUnit root)
beforeTraverse
in class TransformRule
analyzer
- The type analyzer.root
- The root of the AST.TransformRule.afterTraverse(TypeAnalyzer, CompilationUnit)
public java.lang.String getPrefix()
setPrefix(String)
public void setPrefix(java.lang.String prefix)
prefix
- The prefix.getPrefix()