EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql
Class DefaultRefactoringDelta

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.DefaultRefactoringDelta
All Implemented Interfaces:
RefactoringDelta

public class DefaultRefactoringDelta
extends java.lang.Object
implements RefactoringDelta

The default implementation of RefactoringDelta which contains the TextEdit that were creating during the refactoring of a JPQL query.

Version:
2.4
Author:
Pascal Filion
Since:
2.4

Constructor Summary
DefaultRefactoringDelta(java.lang.CharSequence jpqlQuery)
          Creates a new DefaultRefactoringDelta.
 
Method Summary
 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.
 IterableListIterator<TextEdit> textEdits()
          Returns the collection of TextEdit objects that have been added during one or several refactoring operations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRefactoringDelta

public DefaultRefactoringDelta(java.lang.CharSequence jpqlQuery)
Creates a new DefaultRefactoringDelta.

Parameters:
jpqlQuery - The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed
Throws:
java.lang.NullPointerException - The JPQL query cannot be null
Method Detail

addTextEdit

public void addTextEdit(TextEdit textEdit)
Adds the given 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.

Parameters:
textEdit - The TextEdit to add
Throws:
java.lang.NullPointerException - The TextEdit cannot be null

addTextEdits

public void addTextEdits(java.lang.Iterable<? extends TextEdit> textEdits)
Adds the given collection of 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.

Parameters:
textEdits - The collection of TextEdit objects to add
Throws:
java.lang.NullPointerException - The given Iterable or one of the child TextEdit was null

applyChanges

public java.lang.String applyChanges()
Applies the changes to the JPQL query and returns the refactoring operations. The list of TextEdit will be cleared.

Specified by:
applyChanges in interface RefactoringDelta

calculateInsertionPosition

protected int calculateInsertionPosition(TextEdit textEdit)
Calculates the insertion position for the given TextEdit based on those already registered

Parameters:
textEdit - The TextEdit for which its insertion position will be calculated
Returns:
The insertion position for the given TextEdit

hasTextEdits

public boolean hasTextEdits()
Determines whether at least one TextEdit was added.

Specified by:
hasTextEdits in interface RefactoringDelta
Returns:
true if there is at least one TextEdit; false otherwise

initialize

protected void initialize(java.lang.CharSequence jpqlQuery)
Initializes this DefaultRefactoringDelta.

Parameters:
jpqlQuery - The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed
Throws:
java.lang.NullPointerException - The JPQL query cannot be null

size

public int size()
Returns the number of TextEdit objects that have been added.

Specified by:
size in interface RefactoringDelta
Returns:
The count of TextEdit objects

textEdits

public IterableListIterator<TextEdit> textEdits()
Returns the collection of 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.

Specified by:
textEdits in interface RefactoringDelta
Returns:
The ordered collection of TextEdit objects

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference