Class AbstractConditionalClauseStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractConditionalClauseStateObject
-
- All Implemented Interfaces:
StateObject
- Direct Known Subclasses:
HavingClauseStateObject,WhenClauseStateObject,WhereClauseStateObject
public abstract class AbstractConditionalClauseStateObject extends AbstractStateObject
Conditional expressions are composed of other conditional expressions, comparison operations, logical operations, path expressions that evaluate to boolean values, boolean literals, and boolean input parameters. Arithmetic expressions can be used in comparison expressions. Arithmetic expressions are composed of other arithmetic expressions, arithmetic operations, path expressions that evaluate to numeric values, numeric literals, and numeric input parameters. Arithmetic operations use numeric promotion. Standard bracketing () for ordering expression evaluation is supported.BNF:expression ::= identifier conditional_expression- Since:
- 2.4
- Version:
- 2.4
- Author:
- Pascal Filion
- See Also:
AbstractConditionalClause
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONDITIONAL_STATE_OBJECT_PROPERTYNotifies the conditional expression property has changed.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AndExpressionStateObjectandParse(String jpqlFragment)Parses the given JPQL fragment as the right side of anANDexpression.IConditionalExpressionStateObjectBuildergetBuilder()Creates and returns a newIConditionalExpressionStateObjectBuilderthat can be used to programmatically create a conditional expression and once the expression is complete,IConditionalExpressionStateObjectBuilder.commit()will push theStateObjectrepresentation of that expression as this clause's conditional expression.StateObjectgetConditional()Returns the state object representing the composition of the conditional expressions.abstract StringgetIdentifier()Returns the JPQL identifier of this clause.booleanhasConditional()Determines whether theStateObjectrepresenting the conditional expression is present or not.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e.OrExpressionStateObjectorParse(String jpqlFragment)Parses the given JPQL fragment as the right side of anORexpression.voidparse(String jpqlFragment)Parses the given JPQL fragment, which represents a conditional expression, and creates theStateObject.voidsetConditional(StateObject conditionalStateObject)Sets the givenStateObjectto be the conditional expression of this clause.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
addPropertyChangeListener, children, decorate, equals, findIdentificationVariable, getDeclaration, getDecorator, getExpression, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, removePropertyChangeListener, setExpression, setParent, toString, toString, toText
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
accept
-
-
-
-
Field Detail
-
CONDITIONAL_STATE_OBJECT_PROPERTY
public static final String CONDITIONAL_STATE_OBJECT_PROPERTY
Notifies the conditional expression property has changed.- See Also:
- Constant Field Values
-
-
Method Detail
-
andParse
public AndExpressionStateObject andParse(String jpqlFragment)
Parses the given JPQL fragment as the right side of anANDexpression. The current conditional expression will become the left side of theANDexpression.- Parameters:
jpqlFragment- The portion of the query representing the right side of theANDexpression- Returns:
- The newly created
AndExpressionStateObject
-
getBuilder
public IConditionalExpressionStateObjectBuilder getBuilder()
Creates and returns a newIConditionalExpressionStateObjectBuilderthat can be used to programmatically create a conditional expression and once the expression is complete,IConditionalExpressionStateObjectBuilder.commit()will push theStateObjectrepresentation of that expression as this clause's conditional expression.- Returns:
- A new builder that can be used to quickly create a conditional expression
-
getConditional
public StateObject getConditional()
Returns the state object representing the composition of the conditional expressions.- Returns:
- The actual conditional expression
-
getIdentifier
public abstract String getIdentifier()
Returns the JPQL identifier of this clause.- Returns:
- The JPQL identifier of this conditional clause
-
hasConditional
public boolean hasConditional()
Determines whether theStateObjectrepresenting the conditional expression is present or not.- Returns:
trueif the conditional expression is notnull;falseotherwise
-
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- Overrides:
isEquivalentin classAbstractStateObject- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
orParse
public OrExpressionStateObject orParse(String jpqlFragment)
Parses the given JPQL fragment as the right side of anORexpression. The current conditional expression will become the left side of theORexpression.- Parameters:
jpqlFragment- The portion of the query representing the right side of theORexpression- Returns:
- The newly created
OrExpressionStateObject
-
parse
public void parse(String jpqlFragment)
Parses the given JPQL fragment, which represents a conditional expression, and creates theStateObject.- Parameters:
jpqlFragment- The portion of the query representing a conditional expression
-
setConditional
public void setConditional(StateObject conditionalStateObject)
Sets the givenStateObjectto be the conditional expression of this clause.- Parameters:
conditionalStateObject- The newStateObjectrepresenting the conditional expression
-
-