Class RefactoringTool
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.AbstractRefactoringTool
-
- org.eclipse.persistence.jpa.jpql.tools.RefactoringTool
-
- Direct Known Subclasses:
DefaultRefactoringTool
,EclipseLinkRefactoringTool
public abstract class RefactoringTool extends AbstractRefactoringTool
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.
- Since:
- 2.4
- Version:
- 2.4
- Author:
- Pascal Filion
- See Also:
DefaultRefactoringTool
,EclipseLinkRefactoringTool
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IJPQLQueryFormatter
getFormatter()
Returns theIJPQLQueryFormatter
that creates an accurate representation of theStateObject
, i.e.JPQLGrammar
getGrammar()
Returns theJPQLGrammar
that is associated with this builder.IJPQLQueryBuilder
getJPQLQueryBuilder()
Returns the builder that creates theStateObject
representation of the JPQL query.JPQLQueryStateObject
getStateObject()
Returns theStateObject
representation of the JPQL query or JPQL fragment that was parsed.void
renameClassName(String oldClassName, String newClassName)
Renames a fully qualified class name.void
renameEntityName(String oldEntityName, String newEntityName)
Renames a given entity name.void
renameEnumConstant(String oldEnumConstant, String newEnumConstant)
Renames an enum constant, which has to be fully qualified.void
renameField(Class<?> type, String oldFieldName, String newFieldName)
Renames a field from the given type.void
renameField(String typeName, String oldFieldName, String newFieldName)
Renames a field from the given type.void
renameField(IType type, String oldFieldName, String newFieldName)
Renames a field from the given type.void
renameResultVariable(String oldVariableName, String newVariableName)
Renames a result variable name.void
renameVariable(String oldVariableName, String newVariableName)
Renames a variable name.void
setFormatter(IJPQLQueryFormatter jpqlQueryFormatter)
Sets theIJPQLQueryFormatter
that creates an accurate representation of theStateObject
, i.e.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
-
getFormatter
public IJPQLQueryFormatter getFormatter()
Returns theIJPQLQueryFormatter
that creates an accurate representation of theStateObject
, i.e. that output the JPQL query with the case used for the JPQL identifier.- Returns:
- An instance of
IJPQLQueryFormatter
-
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
-
getJPQLQueryBuilder
public IJPQLQueryBuilder getJPQLQueryBuilder()
Returns the builder that creates theStateObject
representation of the JPQL query.- Returns:
- The builder of the
StateObject
to be manipulated
-
getStateObject
public JPQLQueryStateObject getStateObject()
Returns theStateObject
representation of the JPQL query or JPQL fragment that was parsed.- Returns:
- The editable state model
-
renameClassName
public void renameClassName(String oldClassName, 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(String oldEntityName, 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(String oldEnumConstant, 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
-
renameField
public void renameField(Class<?> type, String oldFieldName, String newFieldName)
Renames a field from the given type.- Parameters:
type
- The Java class from which the change originateoldFieldName
- The current name of the attribute to renamenewFieldName
- The new name of the attribute
-
renameField
public void renameField(IType type, String oldFieldName, String newFieldName)
Renames a field from the given type.- Parameters:
type
- TheIType
from which the change originateoldFieldName
- The current name of the attribute to renamenewFieldName
- The new name of the attribute
-
renameField
public void renameField(String typeName, String oldFieldName, String newFieldName)
Renames a field from the given type.- Parameters:
typeName
- The fully qualified name of the type that got one of its attributes renamedoldFieldName
- The current name of the attribute to renamenewFieldName
- The new name of the attribute
-
renameResultVariable
public void renameResultVariable(String oldVariableName, 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(String oldVariableName, String newVariableName)
Renames a variable name.- Parameters:
oldVariableName
- The current identification variable namenewVariableName
- The new name of the identification variable
-
setFormatter
public void setFormatter(IJPQLQueryFormatter jpqlQueryFormatter)
Sets theIJPQLQueryFormatter
that creates an accurate representation of theStateObject
, i.e. that output the JPQL query with the case used for the JPQL identifier.- Parameters:
jpqlQueryFormatter
- This formatter converts aStateObject
representation of the JPQL query into a string representation
-
toActualText
public 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
-
-