Class BasicRefactoringTool
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.AbstractRefactoringTool
-
- org.eclipse.persistence.jpa.jpql.tools.BasicRefactoringTool
-
- Direct Known Subclasses:
DefaultBasicRefactoringTool
,EclipseLinkBasicRefactoringTool
public abstract class BasicRefactoringTool extends AbstractRefactoringTool
The abstract implementation providing refactoring support for JPQL queries. This version does not change thequery
but rather gather the changes inRefactoringDelta
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.
- Since:
- 2.4
- Version:
- 2.6
- Author:
- Pascal Filion
- See Also:
DefaultBasicRefactoringTool
,EclipseLinkBasicRefactoringTool
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 theJPQLGrammar
that is associated with this builder.JPQLQueryContext
getQueryContext()
Returns theJPQLQueryContext
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(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
renameAttribute(IType type, 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.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.AbstractRefactoringTool
getJPQLFragment, getJPQLQueryBNFId, getManagedTypeProvider, isTolerant, setTolerant
-
-
-
-
Method Detail
-
getDelta
public RefactoringDelta getDelta()
Returns the delta of the changes made to the JPQL query.- Returns:
- An object containing the refactoring events
-
getExpression
public JPQLExpression getExpression()
Returns the parsed tree representation of the JPQL query.- Returns:
- The root of the parsed tree
-
getGrammar
public JPQLGrammar getGrammar()
Returns theJPQLGrammar
that is associated with this builder.- Returns:
- The
JPQLGrammar
that was used to parse the JPQL query or JPQL fragments
-
getQueryContext
public JPQLQueryContext getQueryContext()
Returns theJPQLQueryContext
that is used by this visitor.- Returns:
- The
JPQLQueryContext
holding onto the JPQL query and the cached information
-
hasChanges
public boolean hasChanges()
Determines whether some refactoring operations found changes to be made in the JPQL query.- Returns:
true
if there is at least oneTextEdit
;false
otherwise
-
renameAttribute
public 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.- Parameters:
type
- The Java class from which the change originateoldAttributeName
- The current name of the attribute to renamenewAttributeName
- The new name of the attribute
-
renameAttribute
public void renameAttribute(IType type, java.lang.String oldAttributeName, java.lang.String newAttributeName)
Renames the attribute (persistent field or persistent property) from the given type.- Parameters:
type
- TheIType
from which the change originateoldAttributeName
- The current name of the attribute to renamenewAttributeName
- The new name of the attribute
-
renameAttribute
public 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.- Parameters:
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 attribute
-
renameClassName
public void renameClassName(java.lang.String oldClassName, java.lang.String newClassName)
Renames a fully qualified class name.- Parameters:
oldClassName
- The current fully qualified class name of the class to renamenewClassName
- The new fully qualified class name
-
renameEntityName
public void renameEntityName(java.lang.String oldEntityName, java.lang.String newEntityName)
Renames a given entity name.- Parameters:
oldEntityName
- The current name of the entity to renamenewEntityName
- The new name of the entity
-
renameEnumConstant
public void renameEnumConstant(java.lang.String oldEnumConstant, java.lang.String newEnumConstant)
Renames an enum constant, which has to be fully qualified.- Parameters:
oldEnumConstant
- The current fully qualified name of the enum constant to renamenewEnumConstant
- The new fully qualified name of the enum constant
-
renameResultVariable
public void renameResultVariable(java.lang.String oldVariableName, java.lang.String newVariableName)
Renames a result variable name.- Parameters:
oldVariableName
- The current identification variable namenewVariableName
- The new name of the identification variable
-
renameVariable
public void renameVariable(java.lang.String oldVariableName, java.lang.String newVariableName)
Renames a variable name.- Parameters:
oldVariableName
- The current identification variable namenewVariableName
- The new name of the identification variable
-
toActualText
public java.lang.String toActualText()
Returns the resulted of the refactoring operations. The list of changes will be removed after applying the changes.- Specified by:
toActualText
in classAbstractRefactoringTool
- Returns:
- The string representation of the JPQL query that contains the changes
-
-