public abstract class BasicRefactoringTool extends AbstractRefactoringTool
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.
DefaultBasicRefactoringTool
,
EclipseLinkBasicRefactoringTool
Modifier and Type | Class and Description | ||
---|---|---|---|
protected class |
BasicRefactoringTool.AbstractRenamer
The abstract class that all refactoring classes should extend, it automatically provides the
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.
|
Modifier | Constructor and Description |
---|---|
protected |
BasicRefactoringTool(java.lang.CharSequence jpqlQuery,
JPQLGrammar jpqlGrammar,
IManagedTypeProvider managedTypeProvider)
Creates a new
BasicRefactoringTool . |
protected |
BasicRefactoringTool(java.lang.CharSequence jpqlFragment,
JPQLGrammar jpqlGrammar,
IManagedTypeProvider managedTypeProvider,
java.lang.String jpqlQueryBNFId)
Creates a new
BasicRefactoringTool . |
Modifier and Type | Method and Description |
---|---|
protected BasicRefactoringTool.AttributeNameRenamer |
buildAttributeNameRenamer(java.lang.String typeName,
java.lang.String oldAttributeName,
java.lang.String newAttributeName)
Creates the visitor that will traverse the representation of the JPQL
query and will rename a type's attribute name.
|
protected BasicRefactoringTool.ClassNameRenamer |
buildClassNameRenamer(java.lang.String oldClassName,
java.lang.String newClassName)
Creates the visitor that will traverse the representation of the JPQL
query and will rename the fully qualified class name.
|
protected BasicRefactoringTool.EntityNameRenamer |
buildEntityNameRenamer(java.lang.String oldEntityName,
java.lang.String newEntityName)
Creates the visitor that will traverse the representation of the JPQL
query and will rename the entity name.
|
protected BasicRefactoringTool.EnumConstantRenamer |
buildEnumConstantRenamer(java.lang.String oldClassName,
java.lang.String newClassName)
Creates the visitor that will traverse the representation of the JPQL
query and will rename the enum constant.
|
protected abstract JPQLQueryContext |
buildJPQLQueryContext()
Creates a new
JPQLQueryContext that can retrieve information from the declaration
portion of the JPQL query. |
protected BasicRefactoringTool.ResultVariableNameRenamer |
buildResultVariableNameRenamer(java.lang.String oldVariableName,
java.lang.String newVariableName)
Creates the visitor that will traverse the representation of the JPQL
query and will rename a result variable.
|
protected BasicRefactoringTool.VariableNameRenamer |
buildVariableNameRenamer(java.lang.String oldVariableName,
java.lang.String newVariableName)
Creates the visitor that will traverse the representation of the JPQL
query and will rename an identification variable.
|
RefactoringDelta |
getDelta()
Returns the delta of the changes made to the JPQL query.
|
JPQLExpression |
getExpression()
Returns the parsed tree representation of the JPQL query.
|
JPQLGrammar |
getGrammar()
Returns the
JPQLGrammar that is associated with this builder. |
JPQLQueryContext |
getQueryContext()
Returns the
JPQLQueryContext that is used by this visitor. |
boolean |
hasChanges()
Determines whether some refactoring operations found changes to be made in the JPQL query.
|
void |
renameAttribute(java.lang.Class<?> type,
java.lang.String oldAttributeName,
java.lang.String newAttributeName)
Renames the attribute (persistent field or persistent property) from the given type.
|
void |
renameAttribute(IType type,
java.lang.String oldAttributeName,
java.lang.String newAttributeName)
Renames the attribute (persistent field or persistent property) from the given type.
|
void |
renameAttribute(java.lang.String typeName,
java.lang.String oldAttributeName,
java.lang.String newAttributeName)
Renames the attribute (persistent field or persistent property) from the given type.
|
void |
renameClassName(java.lang.String oldClassName,
java.lang.String newClassName)
Renames a fully qualified class name.
|
void |
renameEntityName(java.lang.String oldEntityName,
java.lang.String newEntityName)
Renames a given entity name.
|
void |
renameEnumConstant(java.lang.String oldEnumConstant,
java.lang.String newEnumConstant)
Renames an enum constant, which has to be fully qualified.
|
void |
renameResultVariable(java.lang.String oldVariableName,
java.lang.String newVariableName)
Renames a result variable name.
|
void |
renameVariable(java.lang.String oldVariableName,
java.lang.String newVariableName)
Renames a variable name.
|
java.lang.String |
toActualText()
Returns the resulted of the refactoring operations.
|
getJPQLFragment, getJPQLQueryBNFId, getManagedTypeProvider, isTolerant, setTolerant
protected BasicRefactoringTool(java.lang.CharSequence jpqlQuery, JPQLGrammar jpqlGrammar, IManagedTypeProvider managedTypeProvider)
BasicRefactoringTool
.jpqlQuery
- The JPQL query to manipulatejpqlGrammar
- The JPQLGrammar
that was used to parse the JPQL querymanagedTypeProvider
- The external form of a provider that gives access to the JPA metadataprotected BasicRefactoringTool(java.lang.CharSequence jpqlFragment, JPQLGrammar jpqlGrammar, IManagedTypeProvider managedTypeProvider, java.lang.String jpqlQueryBNFId)
BasicRefactoringTool
.jpqlFragment
- The JPQL query to manipulate or a single JPQL fragment, which is parsed
using the JPQL query BNF identifier by the given IDjpqlGrammar
- The JPQLGrammar
that was used to parse the JPQL fragmentmanagedTypeProvider
- The external form of a provider that gives access to the JPA metadatajpqlQueryBNFId
- The unique identifier of the JPQLQueryBNF
that determines how to parse the JPQL fragmentprotected BasicRefactoringTool.AttributeNameRenamer buildAttributeNameRenamer(java.lang.String typeName, java.lang.String oldAttributeName, java.lang.String newAttributeName)
typeName
- The fully qualified name of the type that got one of its attributes renamedoldAttributeName
- The current name of the attribute to renamenewAttributeName
- The new name of the attributeBasicRefactoringTool.AttributeNameRenamer
protected BasicRefactoringTool.ClassNameRenamer buildClassNameRenamer(java.lang.String oldClassName, java.lang.String newClassName)
oldClassName
- The current name of the class to renamenewClassName
- The new name of the classBasicRefactoringTool.ClassNameRenamer
protected BasicRefactoringTool.EntityNameRenamer buildEntityNameRenamer(java.lang.String oldEntityName, java.lang.String newEntityName)
oldEntityName
- The current name of the entity to renamenewEntityName
- The new name of the entityBasicRefactoringTool.EntityNameRenamer
protected BasicRefactoringTool.EnumConstantRenamer buildEnumConstantRenamer(java.lang.String oldClassName, java.lang.String newClassName)
oldClassName
- The new name of the enum constantnewClassName
- The current name of the enum constant to renameBasicRefactoringTool.EnumConstantRenamer
protected abstract JPQLQueryContext buildJPQLQueryContext()
JPQLQueryContext
that can retrieve information from the declaration
portion of the JPQL query.JPQLQueryContext
protected BasicRefactoringTool.ResultVariableNameRenamer buildResultVariableNameRenamer(java.lang.String oldVariableName, java.lang.String newVariableName)
oldVariableName
- The current result variable namenewVariableName
- The new name of the result variableBasicRefactoringTool.ResultVariableNameRenamer
protected BasicRefactoringTool.VariableNameRenamer buildVariableNameRenamer(java.lang.String oldVariableName, java.lang.String newVariableName)
oldVariableName
- The current identification variable namenewVariableName
- The new name of the identification variableBasicRefactoringTool.VariableNameRenamer
public RefactoringDelta getDelta()
public JPQLExpression getExpression()
public JPQLGrammar getGrammar()
JPQLGrammar
that is associated with this builder.JPQLGrammar
that was used to parse the JPQL query or JPQL fragmentspublic JPQLQueryContext getQueryContext()
JPQLQueryContext
that is used by this visitor.JPQLQueryContext
holding onto the JPQL query and the cached informationpublic boolean hasChanges()
true
if there is at least one TextEdit
; false
otherwisepublic void renameAttribute(java.lang.Class<?> type, java.lang.String oldAttributeName, java.lang.String newAttributeName)
type
- The Java class from which the change originateoldAttributeName
- The current name of the attribute to renamenewAttributeName
- The new name of the attributepublic void renameAttribute(IType type, java.lang.String oldAttributeName, java.lang.String newAttributeName)
type
- The IType
from which the change originateoldAttributeName
- The current name of the attribute to renamenewAttributeName
- The new name of the attributepublic void renameAttribute(java.lang.String typeName, java.lang.String oldAttributeName, java.lang.String newAttributeName)
typeName
- The fully qualified name of the type that got one of its attributes renamedoldAttributeName
- The current name of the attribute to renamenewAttributeName
- The new name of the attributepublic void renameClassName(java.lang.String oldClassName, java.lang.String newClassName)
oldClassName
- The current fully qualified class name of the class to renamenewClassName
- The new fully qualified class namepublic void renameEntityName(java.lang.String oldEntityName, java.lang.String newEntityName)
oldEntityName
- The current name of the entity to renamenewEntityName
- The new name of the entitypublic void renameEnumConstant(java.lang.String oldEnumConstant, java.lang.String newEnumConstant)
oldEnumConstant
- The current fully qualified name of the enum constant to renamenewEnumConstant
- The new fully qualified name of the enum constantpublic void renameResultVariable(java.lang.String oldVariableName, java.lang.String newVariableName)
oldVariableName
- The current identification variable namenewVariableName
- The new name of the identification variablepublic void renameVariable(java.lang.String oldVariableName, java.lang.String newVariableName)
oldVariableName
- The current identification variable namenewVariableName
- The new name of the identification variablepublic java.lang.String toActualText()
toActualText
in class AbstractRefactoringTool