Class DefaultRefactoringDelta
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.DefaultRefactoringDelta
- All Implemented Interfaces:
RefactoringDelta
The default implementation of
RefactoringDelta which contains the TextEdit that
were creating during the refactoring of a JPQL query.- Since:
- 2.4
- Version:
- 2.5
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultRefactoringDelta(CharSequence jpqlQuery) Creates a newDefaultRefactoringDelta. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTextEdit(TextEdit textEdit) Adds the givenTextEditat the right position.voidaddTextEdits(Iterable<? extends TextEdit> textEdits) Adds the given collection ofTextEditobjects.Applies the changes to the JPQL query and returns the refactoring operations.protected intcalculateInsertionPosition(TextEdit textEdit) Calculates the insertion position for the givenTextEditbased on those already registeredbooleanDetermines whether at least oneTextEditwas added.protected voidinitialize(CharSequence jpqlQuery) Initializes thisDefaultRefactoringDelta.intsize()Returns the number ofTextEditobjects that have been added.Returns the collection ofTextEditobjects that have been added during one or several refactoring operations.toString()
-
Constructor Details
-
DefaultRefactoringDelta
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 Details
-
addTextEdit
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
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
Description copied from interface:RefactoringDeltaApplies the changes to the JPQL query and returns the refactoring operations. The list ofTextEditwill be cleared.- Specified by:
applyChangesin interfaceRefactoringDelta
-
calculateInsertionPosition
Calculates the insertion position for the givenTextEditbased on those already registered -
hasTextEdits
public boolean hasTextEdits()Description copied from interface:RefactoringDeltaDetermines whether at least oneTextEditwas added.- Specified by:
hasTextEditsin interfaceRefactoringDelta- Returns:
trueif there is at least oneTextEdit;falseotherwise
-
initialize
Initializes thisDefaultRefactoringDelta.- 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
-
size
public int size()Description copied from interface:RefactoringDeltaReturns the number ofTextEditobjects that have been added.- Specified by:
sizein interfaceRefactoringDelta- Returns:
- The count of
TextEditobjects
-
textEdits
Description copied from interface:RefactoringDeltaReturns 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
-
toString
-