Package spoon.refactoring
Class AbstractRenameRefactoring<T extends CtNamedElement>
java.lang.Object
spoon.refactoring.AbstractRenameRefactoring<T>
- Type Parameters:
T- the type of target renamed element
- All Implemented Interfaces:
CtRefactoring,CtRenameRefactoring<T>
- Direct Known Subclasses:
CtRenameGenericVariableRefactoring,CtRenameLocalVariableRefactoring
public abstract class AbstractRenameRefactoring<T extends CtNamedElement>
extends Object
implements CtRenameRefactoring<T>
abstract implementation of rename element refactoring
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclient may implement this method to check whethernewNameis validprotected voidprotected voidclient may implement this method to check whethernewNameis in conflict with names of other model elementsprotected booleanisJavaIdentifier(String name)Helper method, which can be used by the child classes to check if name is an java identifiervoidrefactor()Process refactoring operationprotected abstract voidsetNewName(String newName)
-
Field Details
-
javaIdentifierRE
-
target
-
newName
-
newNameValidationRE
-
-
Constructor Details
-
AbstractRenameRefactoring
-
-
Method Details
-
refactor
public void refactor()Description copied from interface:CtRefactoringProcess refactoring operation- Specified by:
refactorin interfaceCtRefactoring
-
refactorNoCheck
protected abstract void refactorNoCheck() -
detectIssues
protected void detectIssues() -
checkNewNameIsValid
protected void checkNewNameIsValid()client may implement this method to check whethernewNameis valid -
detectNameConflicts
protected void detectNameConflicts()client may implement this method to check whethernewNameis in conflict with names of other model elements -
isJavaIdentifier
Helper method, which can be used by the child classes to check if name is an java identifier- Parameters:
name- the to be checked name- Returns:
- true if name is valid java identifier
-
getTarget
- Specified by:
getTargetin interfaceCtRenameRefactoring<T extends CtNamedElement>- Returns:
- target model element, which has to be refactored.
-
setTarget
- Specified by:
setTargetin interfaceCtRenameRefactoring<T extends CtNamedElement>- Parameters:
target- the model element, which has to be refactored.- Returns:
- this to support fluent API
-
getNewName
- Specified by:
getNewNamein interfaceCtRenameRefactoring<T extends CtNamedElement>- Returns:
- the required name of the `target` model element
-
setNewName
- Specified by:
setNewNamein interfaceCtRenameRefactoring<T extends CtNamedElement>- Parameters:
newName- the required name of the `target` model element- Returns:
- this to support fluent API
-