public class DefaultRefactoringDelta extends java.lang.Object implements RefactoringDelta
RefactoringDelta
which contains the TextEdit
that
were creating during the refactoring of a JPQL query.Constructor and Description |
---|
DefaultRefactoringDelta(java.lang.CharSequence jpqlQuery)
Creates a new
DefaultRefactoringDelta . |
Modifier and Type | Method and Description |
---|---|
void |
addTextEdit(TextEdit textEdit)
Adds the given
TextEdit at the right position. |
void |
addTextEdits(java.lang.Iterable<? extends TextEdit> textEdits)
Adds the given collection of
TextEdit objects. |
java.lang.String |
applyChanges()
Applies the changes to the JPQL query and returns the refactoring operations.
|
protected int |
calculateInsertionPosition(TextEdit textEdit)
Calculates the insertion position for the given
TextEdit based on those already registered |
boolean |
hasTextEdits()
Determines whether at least one
TextEdit was added. |
protected void |
initialize(java.lang.CharSequence jpqlQuery)
Initializes this
DefaultRefactoringDelta . |
int |
size()
Returns the number of
TextEdit objects that have been added. |
ListIterable<TextEdit> |
textEdits()
Returns the collection of
TextEdit objects that have been added during one or several
refactoring operations. |
java.lang.String |
toString() |
public DefaultRefactoringDelta(java.lang.CharSequence jpqlQuery)
DefaultRefactoringDelta
.jpqlQuery
- The JPQL query or JPQL fragment that will be traversed when refactoring
operations will be executedjava.lang.NullPointerException
- The JPQL query cannot be null
public void addTextEdit(TextEdit textEdit)
TextEdit
at the right position. The list will be kept ordered, meaning
the insertion index is based on the offset, from the biggest value to the smallest value.public void addTextEdits(java.lang.Iterable<? extends TextEdit> textEdits)
TextEdit
objects. The list will be kept ordered, meaning
the insertion index is based on the offset, from the biggest value to the smallest value.public java.lang.String applyChanges()
TextEdit
will be cleared.applyChanges
in interface RefactoringDelta
protected int calculateInsertionPosition(TextEdit textEdit)
TextEdit
based on those already registeredpublic boolean hasTextEdits()
TextEdit
was added.hasTextEdits
in interface RefactoringDelta
true
if there is at least one TextEdit
; false
otherwiseprotected void initialize(java.lang.CharSequence jpqlQuery)
DefaultRefactoringDelta
.jpqlQuery
- The JPQL query or JPQL fragment that will be traversed when refactoring
operations will be executedjava.lang.NullPointerException
- The JPQL query cannot be null
public int size()
TextEdit
objects that have been added.size
in interface RefactoringDelta
TextEdit
objectspublic ListIterable<TextEdit> textEdits()
TextEdit
objects that have been added during one or several
refactoring operations. The collection has been ordered where the TextEdit
's offset
are in reverse order, i.e. from the biggest to the smallest values.textEdits
in interface RefactoringDelta
TextEdit
objectspublic java.lang.String toString()
toString
in class java.lang.Object