Class DefaultRefactoringDelta
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.DefaultRefactoringDelta
-
- All Implemented Interfaces:
RefactoringDelta
public class DefaultRefactoringDelta extends Object implements RefactoringDelta
The default implementation ofRefactoringDeltawhich contains theTextEditthat were creating during the refactoring of a JPQL query.- Since:
- 2.4
- Version:
- 2.5
- Author:
- Pascal Filion
-
-
Constructor Summary
Constructors Constructor Description DefaultRefactoringDelta(CharSequence jpqlQuery)Creates a newDefaultRefactoringDelta.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTextEdit(TextEdit textEdit)Adds the givenTextEditat the right position.voidaddTextEdits(Iterable<? extends TextEdit> textEdits)Adds the given collection ofTextEditobjects.StringapplyChanges()Applies the changes to the JPQL query and returns the refactoring operations.booleanhasTextEdits()Determines whether at least oneTextEditwas added.intsize()Returns the number ofTextEditobjects that have been added.ListIterable<TextEdit>textEdits()Returns the collection ofTextEditobjects that have been added during one or several refactoring operations.StringtoString()
-
-
-
Constructor Detail
-
DefaultRefactoringDelta
public DefaultRefactoringDelta(CharSequence jpqlQuery)
Creates a newDefaultRefactoringDelta.- Parameters:
jpqlQuery- The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed- Throws:
NullPointerException- The JPQL query cannot benull
-
-
Method Detail
-
addTextEdit
public void addTextEdit(TextEdit textEdit)
Adds the givenTextEditat 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.- Parameters:
textEdit- TheTextEditto add- Throws:
NullPointerException- TheTextEditcannot benull
-
addTextEdits
public void addTextEdits(Iterable<? extends TextEdit> textEdits)
Adds the given collection ofTextEditobjects. The list will be kept ordered, meaning the insertion index is based on the offset, from the biggest value to the smallest value.- Parameters:
textEdits- The collection ofTextEditobjects to add- Throws:
NullPointerException- The givenIterableor one of the childTextEditwasnull
-
applyChanges
public String applyChanges()
Applies the changes to the JPQL query and returns the refactoring operations. The list ofTextEditwill be cleared.- Specified by:
applyChangesin interfaceRefactoringDelta
-
hasTextEdits
public boolean hasTextEdits()
Determines whether at least oneTextEditwas added.- Specified by:
hasTextEditsin interfaceRefactoringDelta- Returns:
trueif there is at least oneTextEdit;falseotherwise
-
size
public int size()
Returns the number ofTextEditobjects that have been added.- Specified by:
sizein interfaceRefactoringDelta- Returns:
- The count of
TextEditobjects
-
textEdits
public ListIterable<TextEdit> textEdits()
Returns the collection ofTextEditobjects that have been added during one or several refactoring operations. The collection has been ordered where theTextEdit's offset are in reverse order, i.e. from the biggest to the smallest values.- Specified by:
textEditsin interfaceRefactoringDelta- Returns:
- The ordered collection of
TextEditobjects
-
-