Interface StateObject
-
- All Known Subinterfaces:
DeclarationStateObject,ListHolderStateObject<T>,VariableDeclarationStateObject
- All Known Implementing Classes:
AbsExpressionStateObject,AbstractConditionalClauseStateObject,AbstractDoubleEncapsulatedExpressionStateObject,AbstractEncapsulatedExpressionStateObject,AbstractFromClauseStateObject,AbstractIdentificationVariableDeclarationStateObject,AbstractListHolderStateObject,AbstractModifyClauseStateObject,AbstractModifyStatementStateObject,AbstractPathExpressionStateObject,AbstractRangeVariableDeclarationStateObject,AbstractSchemaNameStateObject,AbstractSelectClauseStateObject,AbstractSelectStatementStateObject,AbstractSingleEncapsulatedExpressionStateObject,AbstractStateObject,AbstractTripleEncapsulatedExpressionStateObject,AdditionExpressionStateObject,AggregateFunctionStateObject,AllOrAnyExpressionStateObject,AndExpressionStateObject,ArithmeticExpressionStateObject,ArithmeticFactorStateObject,AvgFunctionStateObject,BadExpressionStateObject,BetweenExpressionStateObject,CaseExpressionStateObject,CoalesceExpressionStateObject,CollectionExpressionStateObject,CollectionMemberDeclarationStateObject,CollectionMemberExpressionStateObject,CollectionValuedPathExpressionStateObject,ComparisonExpressionStateObject,CompoundExpressionStateObject,ConcatExpressionStateObject,ConstructorExpressionStateObject,CountFunctionStateObject,DateTimeStateObject,DeleteClauseStateObject,DeleteStatementStateObject,DerivedPathIdentificationVariableDeclarationStateObject,DerivedPathVariableDeclarationStateObject,DivisionExpressionStateObject,EmptyCollectionComparisonExpressionStateObject,EncapsulatedIdentificationVariableExpressionStateObject,EntityTypeLiteralStateObject,EntryExpressionStateObject,EnumTypeStateObject,ExistsExpressionStateObject,FromClauseStateObject,FunctionExpressionStateObject,GroupByClauseStateObject,HavingClauseStateObject,IdentificationVariableDeclarationStateObject,IdentificationVariableStateObject,IndexExpressionStateObject,InExpressionStateObject,InputParameterStateObject,JoinStateObject,JPQLQueryStateObject,KeyExpressionStateObject,KeywordExpressionStateObject,LengthExpressionStateObject,LikeExpressionStateObject,LocateExpressionStateObject,LogicalExpressionStateObject,LowerExpressionStateObject,MaxFunctionStateObject,MinFunctionStateObject,ModExpressionStateObject,MultiplicationExpressionStateObject,NotExpressionStateObject,NullComparisonExpressionStateObject,NullIfExpressionStateObject,NumericLiteralStateObject,ObjectExpressionStateObject,OrderByClauseStateObject,OrderByItemStateObject,OrExpressionStateObject,RangeVariableDeclarationStateObject,ResultVariableStateObject,SelectClauseStateObject,SelectStatementStateObject,SimpleFromClauseStateObject,SimpleSelectClauseStateObject,SimpleSelectStatementStateObject,SimpleStateObject,SizeExpressionStateObject,SqrtExpressionStateObject,StateFieldPathExpressionStateObject,StringLiteralStateObject,SubExpressionStateObject,SubstringExpressionStateObject,SubtractionExpressionStateObject,SumFunctionStateObject,TreatExpressionStateObject,TrimExpressionStateObject,TypeExpressionStateObject,UnknownExpressionStateObject,UpdateClauseStateObject,UpdateItemStateObject,UpdateStatementStateObject,UpperExpressionStateObject,ValueExpressionStateObject,WhenClauseStateObject,WhereClauseStateObject
public interface StateObjectAStateObjectis an editable representation of a JPQL query.IJPQLQueryBuildercan be used to create the state model from an existing JPQL query.- Version:
- 2.5
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaccept(StateObjectVisitor visitor)Visits thisStateObjectby the givenvisitor.voidaddPropertyChangeListener(java.lang.String propertyName, IPropertyChangeListener<?> listener)Registers the givenIPropertyChangeListenerfor the specified property.java.lang.Iterable<StateObject>children()Returns the ordered children of thisStateObject.voiddecorate(StateObject decorator)Decorates thisStateObjectwith the given decorator.IdentificationVariableStateObjectfindIdentificationVariable(java.lang.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.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. the information of bothStateObjectis the same.voidremovePropertyChangeListener(java.lang.String propertyName, IPropertyChangeListener<?> listener)Unregisters the givenIPropertyChangeListenerthat was registered for the specified property.voidsetParent(StateObject parent)Sets the givenStateObjectto become the parent of this one.voidtoString(java.lang.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(java.lang.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.
-
-
-
Method Detail
-
accept
void accept(StateObjectVisitor visitor)
Visits thisStateObjectby the givenvisitor.- Parameters:
visitor- Thevisitorto visit this object
-
addPropertyChangeListener
void addPropertyChangeListener(java.lang.String propertyName, IPropertyChangeListener<?> listener)Registers the givenIPropertyChangeListenerfor the specified property. The listener will be notified only for changes to the specified property.- Parameters:
propertyName- The name of the property for which the listener was registeredlistener- The listener to be notified upon changes- Throws:
java.lang.NullPointerException-IPropertyChangeListenercannot benulljava.lang.IllegalArgumentException- The listener is already registered with the property name
-
children
java.lang.Iterable<StateObject> children()
Returns the ordered children of thisStateObject.- Returns:
- The children of this
StateObjector an empty iterable this state object does not have children
-
decorate
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.- Parameters:
decorator- TheStateObjectdecorating this one
-
findIdentificationVariable
IdentificationVariableStateObject findIdentificationVariable(java.lang.String identificationVariable)
Returns theIdentificationVariableStateObjectrepresenting the given identification variable.- Parameters:
identificationVariable- The name of the identification variable to retrieve its state object- Returns:
- The
IdentificationVariableStateObjectdefining the given identification variable
-
getDeclaration
DeclarationStateObject getDeclaration()
Returns the declaration clause which defines the domain of the query by declaring identification variables.- 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
StateObject getDecorator()
Returns theStateObjectdecorating this one if one has been set, which means the behavior of thisStateObjectis modified by the decorator.- Returns:
- The
StateObjectdecorating this one
-
getExpression
Expression getExpression()
Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.- 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
JPQLGrammar getGrammar()
Returns the grammar that defines how to parse a JPQL query.- Returns:
- The grammar that was used to parse the JPQL query
-
getManagedTypeProvider
IManagedTypeProvider getManagedTypeProvider()
Returns the provider of managed types.- Returns:
- The provider that gives access to the managed types
-
getParent
StateObject getParent()
Returns the parent of thisStateObject.- Returns:
- Returns the parent of this
StateObject, which isnullonly when this is the root of the hierarchy
-
getQueryBuilder
IJPQLQueryBuilder getQueryBuilder()
Returns theIJPQLQueryBuilderthat is responsible to create various part of theStateObjecthierarchy.- Returns:
- The builder that created this
StateObjectfrom a JPQL query or that gives access to various sub-builders
-
getRoot
JPQLQueryStateObject getRoot()
Returns the root of theStateObjecthierarchy.- Returns:
- The root of the state model representing the JPQL query
-
isDecorated
boolean isDecorated()
Determines whether thisStateObjectis being decorated by anotherStateObject, which means the behavior is modified by the given one. returntrueif thisStateObjectis being decorated;falseotherwise
-
isEquivalent
boolean isEquivalent(StateObject stateObject)
Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
removePropertyChangeListener
void removePropertyChangeListener(java.lang.String propertyName, IPropertyChangeListener<?> listener)Unregisters the givenIPropertyChangeListenerthat was registered for the specified property. The listener will no longer be notified when the property changes.- Parameters:
propertyName- The name of the property for which the listener was registeredlistener- The listener to unregister- Throws:
java.lang.NullPointerException-IPropertyChangeListenercannot benulljava.lang.IllegalArgumentException- The listener was never registered with the property name
-
setParent
void setParent(StateObject parent)
Sets the givenStateObjectto become the parent of this one.- Parameters:
parent- The new parentStateObjectof this one, which cannot benull
-
toString
void toString(java.lang.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, thentoString(Appendable)from that decorator is invoked, otherwise the information contained in this one will be printed out.- Parameters:
writer- The writer used to print out the string representation- See Also:
toText(Appendable)
-
toText
void toText(java.lang.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.- Parameters:
writer- The writer used to print out the string representation- See Also:
toString(Appendable)
-
-