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

public abstract Class RefactoringTool

extends AbstractRefactoringTool
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.DefaultRefactoringTool, org.eclipse.persistence.jpa.jpql.tools.EclipseLinkRefactoringTool
Imports
org.eclipse.persistence.jpa.jpql.parser.AbstractExpression, .JPQLGrammar, .JPQLStatementBNF, org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder, .IJPQLQueryFormatter, org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractPathExpressionStateObject, .AbstractSchemaNameStateObject, .AbstractTraverseChildrenVisitor, .CollectionValuedPathExpressionStateObject, .ConstructorExpressionStateObject, .EntityTypeLiteralStateObject, .IdentificationVariableStateObject, .JPQLQueryStateObject, .OrderByItemStateObject, .ResultVariableStateObject, .SelectStatementStateObject, .StateFieldPathExpressionStateObject, .StateObject, .TreatExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.spi.IManagedTypeProvider, .IMapping, .IType

The abstract implementation providing refactoring support for JPQL queries.

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.4
See Also
DefaultRefactoringTool, EclipseLinkRefactoringTool

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
RefactoringTool.ClassNameRenamer

This visitor renames a fully qualified class name.

protected static class
RefactoringTool.EntityNameRenamer

This visitor renames an entity name.

protected static class
RefactoringTool.EnumConstantRenamer

This visitor renames an enum constant.

protected static class
RefactoringTool.FieldNameRenamer

This visitor renames any segment of a path expression.

protected static class
RefactoringTool.ResultVariableNameRenamer

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

protected static interface
RefactoringTool.StateObjectUpdater<T extends StateObject>

This interface is used to transparently push the new value into the StateObject.

protected static class
RefactoringTool.VariableNameRenamer

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

Field Summary

Modifier and TypeField and Description
private IJPQLQueryBuilder
jpqlQueryBuilder

The builder that creates the StateObject representation of the JPQL query.

private IJPQLQueryFormatter
jpqlQueryFormatter

The formatter that converts a StateObject representation of the JPQL query into a string representation.

private JPQLQueryStateObject
stateObject

The editable representation of the JPQL query.

Constructor Summary

AccessConstructor and Description
protected
RefactoringTool(IManagedTypeProvider
The external form of a provider that gives access to the JPA metadata
managedTypeProvider
,
IJPQLQueryBuilder
The builder that creates the StateObject representation of the JPQL query
jpqlQueryBuilder
,
CharSequence
The JPQL query to manipulate
jpqlQuery
)

Creates a new RefactoringTool.

protected
RefactoringTool(IManagedTypeProvider
The external form of a provider that gives access to the JPA metadata
managedTypeProvider
,
IJPQLQueryBuilder
The builder that creates the StateObject representation of the JPQL query
jpqlQueryBuilder
,
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
,
String
The unique identifier of the JPQLQueryBNF that determines how to parse the JPQL fragment
jpqlQueryBNFId
)

Creates a new RefactoringTool.

Method Summary

Modifier and TypeMethod and Description
protected RefactoringTool.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 StateObject representation of the JPQL query and will rename the fully qualified class name.

protected RefactoringTool.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 StateObject representation of the JPQL query and will rename the entity name.

protected RefactoringTool.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 StateObject representation of the JPQL query and will rename the enum constant.

protected RefactoringTool.FieldNameRenamer

Returns:

A new AttributeNameRenamer
buildFieldNameRenamer
(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
oldFieldName
,
String
The new name of the attribute
newFieldName
)

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

protected abstract IJPQLQueryFormatter

Returns:

A new concrete instance of IJPQLQueryFormatter
buildFormatter
()

Creates a new formatter that will convert the StateObject representation of the JPQL query, once the refactoring occurred into a string.

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 RefactoringTool.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 StateObject representation of the JPQL query and will rename a result variable.

protected JPQLQueryStateObject

Returns:

The parsed and editable JPQL query
buildStateObject
()

Creates the StateObject representation of the JPQL fragment to manipulate.

protected RefactoringTool.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 StateObject representation of the JPQL query and will rename an identification variable.

public IJPQLQueryFormatter

Returns:

An instance of IJPQLQueryFormatter
getFormatter
()

Returns the IJPQLQueryFormatter that creates an accurate representation of the StateObject, i.e. that output the JPQL query with the case used for the JPQL identifier.

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 IJPQLQueryBuilder

Returns:

The builder of the StateObject to be manipulated
getJPQLQueryBuilder
()

Returns the builder that creates the StateObject representation of the JPQL query.

public JPQLQueryStateObject

Returns:

The editable state model
getStateObject
()

Returns the StateObject representation of the JPQL query or JPQL fragment that was parsed.

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
renameField(Class<?>
The Java class from which the change originate
type
,
String
The current name of the attribute to rename
oldFieldName
,
String
The new name of the attribute
newFieldName
)

Renames a field from the given type.

public void
renameField(IType
The IType from which the change originate
type
,
String
The current name of the attribute to rename
oldFieldName
,
String
The new name of the attribute
newFieldName
)

Renames a field from the given type.

public void
renameField(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
oldFieldName
,
String
The new name of the attribute
newFieldName
)

Renames a field from the given type.

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 void
setFormatter(IJPQLQueryFormatter
This formatter converts a StateObject representation of the JPQL query into a string representation
jpqlQueryFormatter
)

Sets the IJPQLQueryFormatter that creates an accurate representation of the StateObject, i.e. that output the JPQL query with the case used for the JPQL identifier.

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