Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools

public Class DefaultRefactoringDelta

extends Object
implements RefactoringDelta
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta
Annotations
@SuppressWarnings:nls
Imports
java.util.LinkedList, .List, org.eclipse.persistence.jpa.jpql.Assert, org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable, .SnapshotCloneListIterable

The default implementation of RefactoringDelta which contains the TextEdit that were creating during the refactoring of a JPQL query.
Author
Pascal Filion
Since
2.4
Version
2.5

Field Summary

Modifier and TypeField and Description
private CharSequence
jpqlQuery

The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed.

private List<TextEdit>
textEdits

The list of TextEdit objects that have been added by refactoring operations.

Constructor Summary

AccessConstructor and Description
public
DefaultRefactoringDelta(CharSequence
The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed
jpqlQuery
)

Creates a new DefaultRefactoringDelta.

Method Summary

Modifier and TypeMethod and Description
public void
addTextEdit(TextEdit
The TextEdit to add
textEdit
)

Adds the given TextEdit at the right position.

public void
addTextEdits(Iterable<? extends TextEdit>
The collection of TextEdit objects to add
textEdits
)

Adds the given collection of TextEdit objects.

public String
applyChanges()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.applyChanges.

Applies the changes to the JPQL query and returns the refactoring operations.
protected int

Returns:

The insertion position for the given TextEdit
calculateInsertionPosition
(TextEdit
The TextEdit for which its insertion position will be calculated
textEdit
)

Calculates the insertion position for the given TextEdit based on those already registered

public boolean
hasTextEdits()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.hasTextEdits.

Determines whether at least one TextEdit was added.
protected void
initialize(CharSequence
The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed
jpqlQuery
)

Initializes this DefaultRefactoringDelta.

public int
size()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.size.

Returns the number of TextEdit objects that have been added.
public ListIterable<TextEdit>
textEdits()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.textEdits.

Returns the collection of TextEdit objects that have been added during one or several refactoring operations.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

jpqlQueryback to summary
private CharSequence jpqlQuery

The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed.

textEditsback to summary
private List<TextEdit> textEdits

The list of TextEdit objects that have been added by refactoring operations.

Constructor Detail

DefaultRefactoringDeltaback to summary
public DefaultRefactoringDelta(CharSequence jpqlQuery)

Creates a new DefaultRefactoringDelta.

Parameters
jpqlQuery:CharSequence

The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed

Exceptions
NullPointerException:
The JPQL query cannot be null

Method Detail

addTextEditback to summary
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:TextEdit

The TextEdit to add

Exceptions
NullPointerException:
The TextEdit cannot be null
addTextEditsback to summary
public void addTextEdits(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:Iterable<? extends TextEdit>

The collection of TextEdit objects to add

Exceptions
NullPointerException:
The given Iterable or one of the child TextEdit was null
applyChangesback to summary
public String applyChanges()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.applyChanges.

Doc from org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.applyChanges.

Applies the changes to the JPQL query and returns the refactoring operations. The list of TextEdit will be cleared.

Annotations
@Override
calculateInsertionPositionback to summary
protected int calculateInsertionPosition(TextEdit textEdit)

Calculates the insertion position for the given TextEdit based on those already registered

Parameters
textEdit:TextEdit

The TextEdit for which its insertion position will be calculated

Returns:int

The insertion position for the given TextEdit

hasTextEditsback to summary
public boolean hasTextEdits()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.hasTextEdits.

Doc from org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.hasTextEdits.

Determines whether at least one TextEdit was added.

Returns:boolean

true if there is at least one TextEdit; false otherwise

Annotations
@Override
initializeback to summary
protected void initialize(CharSequence jpqlQuery)

Initializes this DefaultRefactoringDelta.

Parameters
jpqlQuery:CharSequence

The JPQL query or JPQL fragment that will be traversed when refactoring operations will be executed

Exceptions
NullPointerException:
The JPQL query cannot be null
sizeback to summary
public int size()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.size.

Doc from org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.size.

Returns the number of TextEdit objects that have been added.

Returns:int

The count of TextEdit objects

Annotations
@Override
textEditsback to summary
public ListIterable<TextEdit> textEdits()

Implements org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.textEdits.

Doc from org.eclipse.persistence.jpa.jpql.tools.RefactoringDelta.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.

Returns:ListIterable<TextEdit>

The ordered collection of TextEdit objects

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override