|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.jpa.jpql.AbstractRefactoringTool org.eclipse.persistence.jpa.jpql.RefactoringTool
public abstract class RefactoringTool
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.
DefaultRefactoringTool
,
EclipseLinkRefactoringTool
Nested Class Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
protected |
RefactoringTool(IManagedTypeProvider managedTypeProvider,
IJPQLQueryBuilder jpqlQueryBuilder,
java.lang.CharSequence jpqlQuery)
Creates a new RefactoringTool . |
protected |
RefactoringTool(IManagedTypeProvider managedTypeProvider,
IJPQLQueryBuilder jpqlQueryBuilder,
java.lang.CharSequence jpqlFragment,
java.lang.String jpqlQueryBNFId)
Creates a new RefactoringTool . |
Method Summary | |
---|---|
protected RefactoringTool.ClassNameRenamer |
buildClassNameRenamer(java.lang.String oldClassName,
java.lang.String 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 |
buildEntityNameRenamer(java.lang.String oldEntityName,
java.lang.String newEntityName)
Creates the visitor that will traverse the StateObject representation of the JPQL
query and will rename the entity name. |
protected RefactoringTool.EnumConstantRenamer |
buildEnumConstantRenamer(java.lang.String oldClassName,
java.lang.String newClassName)
Creates the visitor that will traverse the StateObject representation of the JPQL
query and will rename the enum constant. |
protected RefactoringTool.FieldNameRenamer |
buildFieldNameRenamer(java.lang.String typeName,
java.lang.String oldFieldName,
java.lang.String 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 |
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 |
buildJPQLQueryContext()
Creates a new JPQLQueryContext that can retrieve information from the declaration
portion of the JPQL query. |
protected RefactoringTool.ResultVariableNameRenamer |
buildResultVariableNameRenamer(java.lang.String oldVariableName,
java.lang.String newVariableName)
Creates the visitor that will traverse the StateObject representation of the JPQL
query and will rename a result variable. |
protected JPQLQueryStateObject |
buildStateObject()
Creates the StateObject representation of the JPQL fragment to manipulate. |
protected RefactoringTool.VariableNameRenamer |
buildVariableNameRenamer(java.lang.String oldVariableName,
java.lang.String newVariableName)
Creates the visitor that will traverse the StateObject representation of the JPQL
query and will rename an identification variable. |
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. |
JPQLGrammar |
getGrammar()
Returns the JPQLGrammar that is associated with this builder. |
IJPQLQueryBuilder |
getJPQLQueryBuilder()
Returns the builder that creates the StateObject representation of the JPQL query. |
JPQLQueryStateObject |
getStateObject()
Returns the StateObject representation of the JPQL query or JPQL fragment that was parsed. |
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 |
renameField(java.lang.Class<?> type,
java.lang.String oldFieldName,
java.lang.String newFieldName)
Renames a field from the given type. |
void |
renameField(IType type,
java.lang.String oldFieldName,
java.lang.String newFieldName)
Renames a field from the given type. |
void |
renameField(java.lang.String typeName,
java.lang.String oldFieldName,
java.lang.String newFieldName)
Renames a field from the given type. |
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. |
void |
setFormatter(IJPQLQueryFormatter 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. |
java.lang.String |
toActualText()
Returns the resulted of the refactoring operations. |
Methods inherited from class org.eclipse.persistence.jpa.jpql.AbstractRefactoringTool |
---|
getJPQLFragment, getJPQLQueryBNFId, getManagedTypeProvider, isTolerant, setTolerant |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected RefactoringTool(IManagedTypeProvider managedTypeProvider, IJPQLQueryBuilder jpqlQueryBuilder, java.lang.CharSequence jpqlQuery)
RefactoringTool
.
managedTypeProvider
- The external form of a provider that gives access to the JPA metadatajpqlQueryBuilder
- The builder that creates the StateObject
representation of the
JPQL queryjpqlQuery
- The JPQL query to manipulateprotected RefactoringTool(IManagedTypeProvider managedTypeProvider, IJPQLQueryBuilder jpqlQueryBuilder, java.lang.CharSequence jpqlFragment, java.lang.String jpqlQueryBNFId)
RefactoringTool
.
managedTypeProvider
- The external form of a provider that gives access to the JPA metadatajpqlQueryBuilder
- The builder that creates the StateObject
representation of the
JPQL queryjpqlFragment
- The JPQL query to manipulate or a single JPQL fragment, which is parsed
using the JPQL query BNF identifier by the given IDjpqlQueryBNFId
- The unique identifier of the parser.JPQLQueryBNF JPQLQueryBNF
that determines how to parse the JPQL fragmentMethod Detail |
---|
protected RefactoringTool.ClassNameRenamer buildClassNameRenamer(java.lang.String oldClassName, java.lang.String newClassName)
StateObject
representation of the JPQL
query and will rename the fully qualified class name.
oldClassName
- The current name of the class to renamenewClassName
- The new name of the class
RefactoringTool.ClassNameRenamer
protected RefactoringTool.EntityNameRenamer buildEntityNameRenamer(java.lang.String oldEntityName, java.lang.String newEntityName)
StateObject
representation of the JPQL
query and will rename the entity name.
oldEntityName
- The current name of the entity to renamenewEntityName
- The new name of the entity
RefactoringTool.EntityNameRenamer
protected RefactoringTool.EnumConstantRenamer buildEnumConstantRenamer(java.lang.String oldClassName, java.lang.String newClassName)
StateObject
representation of the JPQL
query and will rename the enum constant.
oldClassName
- The new name of the enum constantnewClassName
- The current name of the enum constant to rename
RefactoringTool.EnumConstantRenamer
protected RefactoringTool.FieldNameRenamer buildFieldNameRenamer(java.lang.String typeName, java.lang.String oldFieldName, java.lang.String newFieldName)
StateObject
representation of the JPQL
query and will rename a type's attribute name.
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
RefactoringTool.FieldNameRenamer
protected abstract IJPQLQueryFormatter buildFormatter()
StateObject
representation of the JPQL
query, once the refactoring occurred into a string.
IJPQLQueryFormatter
protected abstract JPQLQueryContext buildJPQLQueryContext()
JPQLQueryContext
that can retrieve information from the declaration
portion of the JPQL query.
NOTE: This is temporary because the StateObject
API does not have that
knowledge yet.
JPQLQueryContext
protected RefactoringTool.ResultVariableNameRenamer buildResultVariableNameRenamer(java.lang.String oldVariableName, java.lang.String newVariableName)
StateObject
representation of the JPQL
query and will rename a result variable.
oldVariableName
- The current result variable namenewVariableName
- The new name of the result variable
RefactoringTool.ResultVariableNameRenamer
protected JPQLQueryStateObject buildStateObject()
StateObject
representation of the JPQL fragment to manipulate.
getStateObject()
protected RefactoringTool.VariableNameRenamer buildVariableNameRenamer(java.lang.String oldVariableName, java.lang.String newVariableName)
StateObject
representation of the JPQL
query and will rename an identification variable.
oldVariableName
- The current identification variable namenewVariableName
- The new name of the identification variable
RefactoringTool.ResultVariableNameRenamer
public IJPQLQueryFormatter getFormatter()
IJPQLQueryFormatter
that creates an accurate representation of the StateObject
, i.e. that output the JPQL query with the case used for the JPQL identifier.
IJPQLQueryFormatter
public JPQLGrammar getGrammar()
JPQLGrammar
that is associated with this builder.
JPQLGrammar
that was used to parse the JPQL query or JPQL fragmentspublic IJPQLQueryBuilder getJPQLQueryBuilder()
StateObject
representation of the JPQL query.
StateObject
to be manipulatedpublic JPQLQueryStateObject getStateObject()
StateObject
representation of the JPQL query or JPQL fragment that was parsed.
public 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 renameField(java.lang.Class<?> type, java.lang.String oldFieldName, java.lang.String newFieldName)
type
- The Java class from which the change originateoldFieldName
- The current name of the attribute to renamenewFieldName
- The new name of the attributepublic void renameField(IType type, java.lang.String oldFieldName, java.lang.String newFieldName)
type
- The IType
from which the change originateoldFieldName
- The current name of the attribute to renamenewFieldName
- The new name of the attributepublic void renameField(java.lang.String typeName, java.lang.String oldFieldName, java.lang.String newFieldName)
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 attributepublic 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 void setFormatter(IJPQLQueryFormatter jpqlQueryFormatter)
IJPQLQueryFormatter
that creates an accurate representation of the StateObject
, i.e. that output the JPQL query with the case used for the JPQL identifier.
jpqlQueryFormatter
- This formatter converts a StateObject
representation of the
JPQL query into a string representationpublic java.lang.String toActualText()
toActualText
in class AbstractRefactoringTool
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |