Class BasicRefactoringTool.AbstractRenamer
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor
-
- org.eclipse.persistence.jpa.jpql.parser.AbstractTraverseChildrenVisitor
-
- org.eclipse.persistence.jpa.jpql.tools.BasicRefactoringTool.AbstractRenamer
-
- All Implemented Interfaces:
ExpressionVisitor
- Direct Known Subclasses:
BasicRefactoringTool.AttributeNameRenamer
,BasicRefactoringTool.ClassNameRenamer
,BasicRefactoringTool.EntityNameRenamer
,BasicRefactoringTool.EnumConstantRenamer
,BasicRefactoringTool.ResultVariableNameRenamer
,BasicRefactoringTool.VariableNameRenamer
- Enclosing class:
- BasicRefactoringTool
protected abstract class BasicRefactoringTool.AbstractRenamer extends AbstractTraverseChildrenVisitor
The abstract class that all refactoring classes should extend, it automatically provides the MultiTextEdit that will hold theTextEdit
objects that are related to the same refactoring event.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRenamer()
Creates a newAbstractRenamer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTextEdit(Expression expression, int extraOffset, java.lang.String oldValue, java.lang.String newValue)
Adds a newTextEdit
with the given information.protected void
addTextEdit(Expression expression, java.lang.String oldValue, java.lang.String newValue)
Adds a newTextEdit
with the given information.protected TextEdit
buildTextEdit(int offset, java.lang.String oldValue, java.lang.String newValue)
Creates a newTextEdit
for the given refactoring information.protected int
reposition(int offset)
Repositions the given position that is based on the generated JPQL query to be the position from the JPQL fragment that was parsed.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.parser.AbstractTraverseChildrenVisitor
visit
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
-
-
-
-
Method Detail
-
addTextEdit
protected void addTextEdit(Expression expression, int extraOffset, java.lang.String oldValue, java.lang.String newValue)
Adds a newTextEdit
with the given information.- Parameters:
expression
- TheExpression
which should be refactored, it will be used to retrieve the offset of the changeextraOffset
- Additional offset that will be added to the givenExpression
's offset, which is the length of the string representation of what is before itoldValue
- The old value to change to the new onenewValue
- The new value
-
addTextEdit
protected void addTextEdit(Expression expression, java.lang.String oldValue, java.lang.String newValue)
Adds a newTextEdit
with the given information.- Parameters:
expression
- TheExpression
which should be refactored, it will be used to retrieve the offset of the changeoldValue
- The old value to change to the new onenewValue
- The new value
-
buildTextEdit
protected TextEdit buildTextEdit(int offset, java.lang.String oldValue, java.lang.String newValue)
Creates a newTextEdit
for the given refactoring information.- Parameters:
offset
- The position where the change should be made within the actual JPQL fragmentoldValue
- The old value to change to the new onenewValue
- The new value- Returns:
- A new
TextEdit
-
reposition
protected int reposition(int offset)
Repositions the given position that is based on the generated JPQL query to be the position from the JPQL fragment that was parsed.- Parameters:
offset
- The position within the string generated byExpression.toActualText()
- Returns:
- The position within the JPQL fragment that was passed to the refactoring tool
-
-