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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
client may implement this method to check whethernewName
is validprotected void
protected void
client may implement this method to check whethernewName
is in conflict with names of other model elementsprotected boolean
isJavaIdentifier(String name)
Helper method, which can be used by the child classes to check if name is an java identifiervoid
refactor()
Process refactoring operationprotected abstract void
setNewName(String newName)
-
Field Details
-
javaIdentifierRE
-
target
-
newName
-
newNameValidationRE
-
-
Constructor Details
-
AbstractRenameRefactoring
-
-
Method Details
-
refactor
public void refactor()Description copied from interface:CtRefactoring
Process refactoring operation- Specified by:
refactor
in interfaceCtRefactoring
-
refactorNoCheck
protected abstract void refactorNoCheck() -
detectIssues
protected void detectIssues() -
checkNewNameIsValid
protected void checkNewNameIsValid()client may implement this method to check whethernewName
is valid -
detectNameConflicts
protected void detectNameConflicts()client may implement this method to check whethernewName
is 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:
getTarget
in interfaceCtRenameRefactoring<T extends CtNamedElement>
- Returns:
- target model element, which has to be refactored.
-
setTarget
- Specified by:
setTarget
in interfaceCtRenameRefactoring<T extends CtNamedElement>
- Parameters:
target
- the model element, which has to be refactored.- Returns:
- this to support fluent API
-
getNewName
- Specified by:
getNewName
in interfaceCtRenameRefactoring<T extends CtNamedElement>
- Returns:
- the required name of the `target` model element
-
setNewName
- Specified by:
setNewName
in interfaceCtRenameRefactoring<T extends CtNamedElement>
- Parameters:
newName
- the required name of the `target` model element- Returns:
- this to support fluent API
-