Class AbstractRenameRefactoring<T extends CtNamedElement>

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 Details

    • javaIdentifierRE

      public static final Pattern javaIdentifierRE
    • target

      protected T extends CtNamedElement target
    • newName

      protected String newName
    • newNameValidationRE

      protected Pattern newNameValidationRE
  • Constructor Details

    • AbstractRenameRefactoring

      protected AbstractRenameRefactoring(Pattern newNameValidationRE)
  • Method Details

    • refactor

      public void refactor()
      Description copied from interface: CtRefactoring
      Process refactoring operation
      Specified by:
      refactor in interface CtRefactoring
    • refactorNoCheck

      protected abstract void refactorNoCheck()
    • detectIssues

      protected void detectIssues()
    • checkNewNameIsValid

      protected void checkNewNameIsValid()
      client may implement this method to check whether newName is valid
    • detectNameConflicts

      protected void detectNameConflicts()
      client may implement this method to check whether newName is in conflict with names of other model elements
    • isJavaIdentifier

      protected boolean isJavaIdentifier(String name)
      Helper method, which can be used by the child classes to check if name is an java identifier
      name - the to be checked name
      true if name is valid java identifier
    • getTarget

      public T getTarget()
      Specified by:
      getTarget in interface CtRenameRefactoring<T extends CtNamedElement>
      target model element, which has to be refactored.
    • setTarget

      public AbstractRenameRefactoring<T> setTarget(T target)
      Specified by:
      setTarget in interface CtRenameRefactoring<T extends CtNamedElement>
      target - the model element, which has to be refactored.
      this to support fluent API
    • getNewName

      public String getNewName()
      Specified by:
      getNewName in interface CtRenameRefactoring<T extends CtNamedElement>
      the required name of the `target` model element
    • setNewName

      public AbstractRenameRefactoring<T> setNewName(String newName)
      Specified by:
      setNewName in interface CtRenameRefactoring<T extends CtNamedElement>
      newName - the required name of the `target` model element
      this to support fluent API