Class AbstractStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- All Implemented Interfaces:
StateObject
- Direct Known Subclasses:
AbstractConditionalClauseStateObject,AbstractEncapsulatedExpressionStateObject,AbstractListHolderStateObject,AbstractModifyClauseStateObject,AbstractModifyStatementStateObject,AbstractPathExpressionStateObject,AbstractRangeVariableDeclarationStateObject,AbstractSelectClauseStateObject,AbstractSelectStatementStateObject,ArithmeticFactorStateObject,BetweenExpressionStateObject,CollectionExpressionStateObject,CollectionMemberDeclarationStateObject,CollectionMemberExpressionStateObject,CompoundExpressionStateObject,EmptyCollectionComparisonExpressionStateObject,FunctionExpressionStateObject,JoinStateObject,JPQLQueryStateObject,LikeExpressionStateObject,NotExpressionStateObject,NullComparisonExpressionStateObject,OrderByItemStateObject,ResultVariableStateObject,SimpleStateObject,TreatExpressionStateObject,UpdateItemStateObject
public abstract class AbstractStateObject extends Object implements StateObject
The abstract definition of aStateObject.- Since:
- 2.4
- Version:
- 2.5
- Author:
- Pascal Filion
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(String propertyName, IPropertyChangeListener<?> listener)Registers the givenIPropertyChangeListenerfor the specified property.Iterable<StateObject>children()Returns the ordered children of thisStateObject.voiddecorate(StateObject decorator)Decorates thisStateObjectwith the given decorator.booleanequals(Object object)IdentificationVariableStateObjectfindIdentificationVariable(String identificationVariable)Returns theIdentificationVariableStateObjectrepresenting the given identification variable.DeclarationStateObjectgetDeclaration()Returns the declaration clause which defines the domain of the query by declaring identification variables.StateObjectgetDecorator()Returns theStateObjectdecorating this one if one has been set, which means the behavior of thisStateObjectis modified by the decorator.ExpressiongetExpression()Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.JPQLGrammargetGrammar()Returns the grammar that defines how to parse a JPQL query.IManagedTypeProvidergetManagedTypeProvider()Returns the provider of managed types.StateObjectgetParent()Returns the parent of thisStateObject.IJPQLQueryBuildergetQueryBuilder()Returns theIJPQLQueryBuilderthat is responsible to create various part of theStateObjecthierarchy.JPQLQueryStateObjectgetRoot()Returns the root of theStateObjecthierarchy.ITypegetType(Class<?> type)Retrieves the external type for the given Java type.ITypegetType(String typeName)Retrieves the external class for the given fully qualified class name.TypeHelpergetTypeHelper()Returns a helper that gives access to the most commontypes.ITypeRepositorygetTypeRepository()Returns the type repository for the application.inthashCode()booleanisDecorated()Determines whether thisStateObjectis being decorated by anotherStateObject, which means the behavior is modified by the given one.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e.voidremovePropertyChangeListener(String propertyName, IPropertyChangeListener<?> listener)Unregisters the givenIPropertyChangeListenerthat was registered for the specified property.voidsetExpression(Expression expression)Sets the actual parsed object if thisStateObjectrepresentation of the JPQL query is created by converting the parsed representation of the JPQL query.voidsetParent(StateObject parent)Sets the givenStateObjectto become the parent of this one.StringtoString()voidtoString(Appendable writer)Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.voidtoText(Appendable writer)Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
accept
-
-
-
-
Method Detail
-
addPropertyChangeListener
public final void addPropertyChangeListener(String propertyName, IPropertyChangeListener<?> listener)
Registers the givenIPropertyChangeListenerfor the specified property. The listener will be notified only for changes to the specified property.- Specified by:
addPropertyChangeListenerin interfaceStateObject- Parameters:
propertyName- The name of the property for which the listener was registeredlistener- The listener to be notified upon changes
-
children
public final Iterable<StateObject> children()
Returns the ordered children of thisStateObject.- Specified by:
childrenin interfaceStateObject- Returns:
- The children of this
StateObjector an empty iterable this state object does not have children
-
decorate
public void decorate(StateObject decorator)
Decorates thisStateObjectwith the given decorator. It means the behavior of thisStateObjectis modified by the given one. By default, thisStateObjectbecomes the parent of the given one.- Specified by:
decoratein interfaceStateObject- Parameters:
decorator- TheStateObjectdecorating this one
-
findIdentificationVariable
public IdentificationVariableStateObject findIdentificationVariable(String identificationVariable)
Returns theIdentificationVariableStateObjectrepresenting the given identification variable.- Specified by:
findIdentificationVariablein interfaceStateObject- Parameters:
identificationVariable- The name of the identification variable to retrieve its state object- Returns:
- The
IdentificationVariableStateObjectdefining the given identification variable
-
getDeclaration
public DeclarationStateObject getDeclaration()
Returns the declaration clause which defines the domain of the query by declaring identification variables.- Specified by:
getDeclarationin interfaceStateObject- Returns:
- The declaration clause of which this
StateObjectis a child; i.e. either the top-level declaration if this is part of the top query or the sub-level declaration if this is part of a subquery
-
getDecorator
public StateObject getDecorator()
Returns theStateObjectdecorating this one if one has been set, which means the behavior of thisStateObjectis modified by the decorator.- Specified by:
getDecoratorin interfaceStateObject- Returns:
- The
StateObjectdecorating this one
-
getExpression
public Expression getExpression()
Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpressionin interfaceStateObject- Returns:
- The parsed object when a JPQL query is parsed and converted into a
StateObjectornullwhen the JPQL query is manually created (i.e. not from a string)
-
getGrammar
public JPQLGrammar getGrammar()
Returns the grammar that defines how to parse a JPQL query.- Specified by:
getGrammarin interfaceStateObject- Returns:
- The grammar that was used to parse the JPQL query
-
getManagedTypeProvider
public IManagedTypeProvider getManagedTypeProvider()
Returns the provider of managed types.- Specified by:
getManagedTypeProviderin interfaceStateObject- Returns:
- The provider that gives access to the managed types
-
getParent
public StateObject getParent()
Returns the parent of thisStateObject.- Specified by:
getParentin interfaceStateObject- Returns:
- Returns the parent of this
StateObject, which isnullonly when this is the root of the hierarchy
-
getQueryBuilder
public IJPQLQueryBuilder getQueryBuilder()
Returns theIJPQLQueryBuilderthat is responsible to create various part of theStateObjecthierarchy.- Specified by:
getQueryBuilderin interfaceStateObject- Returns:
- The builder that created this
StateObjectfrom a JPQL query or that gives access to various sub-builders
-
getRoot
public JPQLQueryStateObject getRoot()
Returns the root of theStateObjecthierarchy.- Specified by:
getRootin interfaceStateObject- Returns:
- The root of the state model representing the JPQL query
-
getType
public IType getType(Class<?> type)
Retrieves the external type for the given Java type.- Parameters:
type- The Java type to wrap with an external form- Returns:
- The external form of the given type
-
getType
public IType getType(String typeName)
Retrieves the external class for the given fully qualified class name.- Parameters:
typeName- The fully qualified class name of the class to retrieve- Returns:
- The external form of the class to retrieve
-
getTypeHelper
public TypeHelper getTypeHelper()
Returns a helper that gives access to the most commontypes.- Returns:
- A helper containing a collection of methods related to
IType
-
getTypeRepository
public ITypeRepository getTypeRepository()
Returns the type repository for the application.- Returns:
- The repository of
ITypes
-
isDecorated
public boolean isDecorated()
Determines whether thisStateObjectis being decorated by anotherStateObject, which means the behavior is modified by the given one. returntrueif thisStateObjectis being decorated;falseotherwise- Specified by:
isDecoratedin interfaceStateObject
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.- Specified by:
isEquivalentin interfaceStateObject- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
removePropertyChangeListener
public final void removePropertyChangeListener(String propertyName, IPropertyChangeListener<?> listener)
Unregisters the givenIPropertyChangeListenerthat was registered for the specified property. The listener will no longer be notified when the property changes.- Specified by:
removePropertyChangeListenerin interfaceStateObject- Parameters:
propertyName- The name of the property for which the listener was registeredlistener- The listener to unregister
-
setExpression
public void setExpression(Expression expression)
Sets the actual parsed object if thisStateObjectrepresentation of the JPQL query is created by converting the parsed representation of the JPQL query.- Parameters:
expression- The parsed object when a JPQL query is parsed
-
setParent
public final void setParent(StateObject parent)
Sets the givenStateObjectto become the parent of this one.- Specified by:
setParentin interfaceStateObject- Parameters:
parent- The new parentStateObjectof this one, which cannot benull
-
toString
public final void toString(Appendable writer)
Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.Important: If this
StateObjectis decorated by another one, thenStateObject.toString(Appendable)from that decorator is invoked, otherwise the information contained in this one will be printed out.- Specified by:
toStringin interfaceStateObject- Parameters:
writer- The writer used to print out the string representation- See Also:
StateObject.toText(Appendable)
-
toText
public final void toText(Appendable writer)
Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.Important: Even if this
StateObjectis decorated by another one, the decorator will not be used to print out a string representation of this one.- Specified by:
toTextin interfaceStateObject- Parameters:
writer- The writer used to print out the string representation- See Also:
StateObject.toString(Appendable)
-
-