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

public abstract Class BasicRefactoringTool

extends AbstractRefactoringTool
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.DefaultBasicRefactoringTool, org.eclipse.persistence.jpa.jpql.tools.EclipseLinkBasicRefactoringTool
Annotations
@SuppressWarnings:nls
Imports
java.util.ArrayList, .List, org.eclipse.persistence.jpa.jpql.ExpressionTools, org.eclipse.persistence.jpa.jpql.parser.AbstractExpression, .AbstractPathExpression, .AbstractSchemaName, .AbstractTraverseChildrenVisitor, .CollectionValuedPathExpression, .ConstructorExpression, .EntityTypeLiteral, .Expression, .IdentificationVariable, .JPQLExpression, .JPQLGrammar, .JPQLStatementBNF, .ResultVariable, .SelectStatement, .StateFieldPathExpression, org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver, .StateFieldResolver, org.eclipse.persistence.jpa.jpql.tools.spi.IManagedTypeProvider, .IMapping, .IQuery, .IType

The abstract implementation providing refactoring support for JPQL queries. This version does not change the query but rather gather the changes in RefactoringDelta and it is the responsibility of the invoker to the actual change.

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Author
Pascal Filion
Since
2.4
Version
2.6
See Also
DefaultBasicRefactoringTool, EclipseLinkBasicRefactoringTool

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class
BasicRefactoringTool.AbstractRenamer

The abstract class that all refactoring classes should extend, it automatically provides the MultiTextEdit that will hold the TextEdit objects that are related to the same refactoring event.

protected class
BasicRefactoringTool.AttributeNameRenamer

This visitor renames any segment of a path expression.

protected class
BasicRefactoringTool.ClassNameRenamer

This visitor renames a fully qualified class name.

protected class
BasicRefactoringTool.EntityNameRenamer

This visitor renames an entity name.

protected class
BasicRefactoringTool.EnumConstantRenamer

This visitor renames an enum constant.

protected static class
BasicRefactoringTool.JavaQuery

A simple implementation of IQuery.

protected class
BasicRefactoringTool.ResultVariableNameRenamer

This visitor renames all the result variables found in the JPQL query.

protected class
BasicRefactoringTool.VariableNameRenamer

This visitor renames all the identification variables found in the JPQL query.

Field Summary

Modifier and TypeField and Description
private DefaultRefactoringDelta
delta

Keeps track of the changes made to the JPQL query.

private JPQLExpression
jpqlExpression

The parsed tree representation of the JPQL query.

private JPQLGrammar
jpqlGrammar

The JPQLGrammar that was used to parse the JPQL query or JPQL fragments.

private JPQLQueryContext
queryContext

The context used to query information about the JPQL query.

Constructor Summary

AccessConstructor and Description
protected
BasicRefactoringTool(CharSequence
The JPQL query to manipulate
jpqlQuery
,
JPQLGrammar
The JPQLGrammar that was used to parse the JPQL query
jpqlGrammar
,
IManagedTypeProvider
The external form of a provider that gives access to the JPA metadata
managedTypeProvider
)

Creates a new BasicRefactoringTool.

protected
BasicRefactoringTool(CharSequence
The JPQL query to manipulate or a single JPQL fragment, which is parsed using the JPQL query BNF identifier by the given ID
jpqlFragment
,
JPQLGrammar
The JPQLGrammar that was used to parse the JPQL fragment
jpqlGrammar
,
IManagedTypeProvider
The external form of a provider that gives access to the JPA metadata
managedTypeProvider
,
String
The unique identifier of the JPQLQueryBNF that determines how to parse the JPQL fragment
jpqlQueryBNFId
)

Creates a new BasicRefactoringTool.

Method Summary

Modifier and TypeMethod and Description
protected BasicRefactoringTool.AttributeNameRenamer

Returns:

A new AttributeNameRenamer
buildAttributeNameRenamer
(String
The fully qualified name of the type that got one of its attributes renamed
typeName
,
String
The current name of the attribute to rename
oldAttributeName
,
String
The new name of the attribute
newAttributeName
)

Creates the visitor that will traverse the representation of the JPQL query and will rename a type's attribute name.

protected BasicRefactoringTool.ClassNameRenamer

Returns:

A new ClassNameRenamer
buildClassNameRenamer
(String
The current name of the class to rename
oldClassName
,
String
The new name of the class
newClassName
)

Creates the visitor that will traverse the representation of the JPQL query and will rename the fully qualified class name.

protected BasicRefactoringTool.EntityNameRenamer

Returns:

A new EntityNameRenamer
buildEntityNameRenamer
(String
The current name of the entity to rename
oldEntityName
,
String
The new name of the entity
newEntityName
)

Creates the visitor that will traverse the representation of the JPQL query and will rename the entity name.

protected BasicRefactoringTool.EnumConstantRenamer

Returns:

A new EnumConstantRenamer
buildEnumConstantRenamer
(String
The new name of the enum constant
oldClassName
,
String
The current name of the enum constant to rename
newClassName
)

Creates the visitor that will traverse the representation of the JPQL query and will rename the enum constant.

protected abstract JPQLQueryContext

Returns:

A new concrete instance of JPQLQueryContext
buildJPQLQueryContext
()

Creates a new JPQLQueryContext that can retrieve information from the declaration portion of the JPQL query.

protected BasicRefactoringTool.ResultVariableNameRenamer
buildResultVariableNameRenamer(String
The current result variable name
oldVariableName
,
String
The new name of the result variable
newVariableName
)

Creates the visitor that will traverse the representation of the JPQL query and will rename a result variable.

protected BasicRefactoringTool.VariableNameRenamer

Returns:

A new VariableNameRenamer
buildVariableNameRenamer
(String
The current identification variable name
oldVariableName
,
String
The new name of the identification variable
newVariableName
)

Creates the visitor that will traverse the representation of the JPQL query and will rename an identification variable.

public RefactoringDelta

Returns:

An object containing the refactoring events
getDelta
()

Returns the delta of the changes made to the JPQL query.

public JPQLExpression

Returns:

The root of the parsed tree
getExpression
()

Returns the parsed tree representation of the JPQL query.

public JPQLGrammar

Returns:

The JPQLGrammar that was used to parse the JPQL query or JPQL fragments
getGrammar
()

Returns the JPQLGrammar that is associated with this builder.

public JPQLQueryContext

Returns:

The JPQLQueryContext holding onto the JPQL query and the cached information
getQueryContext
()

Returns the JPQLQueryContext that is used by this visitor.

public boolean

Returns:

true if there is at least one TextEdit; false otherwise
hasChanges
()

Determines whether some refactoring operations found changes to be made in the JPQL query.

public void
renameAttribute(Class<?>
The Java class from which the change originate
type
,
String
The current name of the attribute to rename
oldAttributeName
,
String
The new name of the attribute
newAttributeName
)

Renames the attribute (persistent field or persistent property) from the given type.

public void
renameAttribute(IType
The IType from which the change originate
type
,
String
The current name of the attribute to rename
oldAttributeName
,
String
The new name of the attribute
newAttributeName
)

Renames the attribute (persistent field or persistent property) from the given type.

public void
renameAttribute(String
The fully qualified name of the type that got one of its attributes renamed
typeName
,
String
The current name of the attribute to rename
oldAttributeName
,
String
The new name of the attribute
newAttributeName
)

Renames the attribute (persistent field or persistent property) from the given type.

public void
renameClassName(String
The current fully qualified class name of the class to rename
oldClassName
,
String
The new fully qualified class name
newClassName
)

Renames a fully qualified class name.

public void
renameEntityName(String
The current name of the entity to rename
oldEntityName
,
String
The new name of the entity
newEntityName
)

Renames a given entity name.

public void
renameEnumConstant(String
The current fully qualified name of the enum constant to rename
oldEnumConstant
,
String
The new fully qualified name of the enum constant
newEnumConstant
)

Renames an enum constant, which has to be fully qualified.

public void
renameResultVariable(String
The current identification variable name
oldVariableName
,
String
The new name of the identification variable
newVariableName
)

Renames a result variable name.

public void
renameVariable(String
The current identification variable name
oldVariableName
,
String
The new name of the identification variable
newVariableName
)

Renames a variable name.

public String
toActualText()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.AbstractRefactoringTool.toActualText.

Returns the resulted of the refactoring operations.
Inherited from org.eclipse.persistence.jpa.jpql.tools.AbstractRefactoringTool:
getJPQLFragmentgetJPQLQueryBNFIdgetManagedTypeProviderisTolerantsetTolerant