Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public abstract Class AbstractConditionalClauseStateObject

extends AbstractStateObject
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.HavingClauseStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.WhenClauseStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.WhereClauseStateObject
Annotations
@SuppressWarnings:nls
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.ConditionalExpressionBNF, org.eclipse.persistence.jpa.jpql.tools.model.IConditionalExpressionStateObjectBuilder

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

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
AbstractConditionalClause

Field Summary

Modifier and TypeField and Description
private IConditionalExpressionStateObjectBuilder
builder

The builder is cached during the creation of the conditional expression.

public static final String
CONDITIONAL_STATE_OBJECT_PROPERTY

Notifies the conditional expression property has changed.

private StateObject
conditionalStateObject

The state object representing the composition of the conditional expressions.

Constructor Summary

AccessConstructor and Description
protected
AbstractConditionalClauseStateObject(StateObject
The parent of this state object, which cannot be null
parent
)

Creates a new AbstractConditionalClauseStateObject.

protected
AbstractConditionalClauseStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the conditional expression
conditionalStateObject
)

Creates a new AbstractConditionalClauseStateObject.

Method Summary

Modifier and TypeMethod and Description
protected void
addChildren(List<StateObject>
The list used to store the children
children
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.
public AndExpressionStateObject

Returns:

The newly created AndExpressionStateObject
andParse
(String
The portion of the query representing the right side of the AND expression
jpqlFragment
)

Parses the given JPQL fragment as the right side of an AND expression.

public IConditionalExpressionStateObjectBuilder

Returns:

A new builder that can be used to quickly create a conditional expression
getBuilder
()

Creates and returns a new IConditionalExpressionStateObjectBuilder that can be used to programmatically create a conditional expression and once the expression is complete, IConditionalExpressionStateObjectBuilder#commit() will push the StateObject representation of that expression as this clause's conditional expression.

public StateObject

Returns:

The actual conditional expression
getConditional
()

Returns the state object representing the composition of the conditional expressions.

public abstract String

Returns:

The JPQL identifier of this conditional clause
getIdentifier
()

Returns the JPQL identifier of this clause.

public boolean

Returns:

true if the conditional expression is not null; false otherwise
hasConditional
()

Determines whether the StateObject representing the conditional expression is present or not.

public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
public OrExpressionStateObject

Returns:

The newly created OrExpressionStateObject
orParse
(String
The portion of the query representing the right side of the OR expression
jpqlFragment
)

Parses the given JPQL fragment as the right side of an OR expression.

public void
parse(String
The portion of the query representing a conditional expression
jpqlFragment
)

Parses the given JPQL fragment, which represents a conditional expression, and creates the StateObject.

public void
setConditional(StateObject
The new StateObject representing the conditional expression
conditionalStateObject
)

Sets the given StateObject to be the conditional expression of this clause.

protected boolean
protected void
toTextInternal(Appendable
The writer used to print out the string representation
writer
)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.
Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject:
acceptUnknownVisitoracceptUnknownVisitoraddProblemsaddPropertyChangeListenerareEquivalentbuildProblembuildProblembuildStateObjectbuildStateObjectscheckParentchildrendecorateequalsfindIdentificationVariablefirePropertyChangedgetChangeSupportgetDeclarationgetDecoratorgetExpressiongetGrammargetManagedTypeProvidergetParentgetQueryBuildergetRootgetTypegetTypegetTypeHelpergetTypeRepositoryhashCodeinitializeisDecoratedparentparentparentremovePropertyChangeListenersetExpressionsetParenttoStringtoStringtoStringInternaltoStringItemstoText

Field Detail

builderback to summary
private IConditionalExpressionStateObjectBuilder builder

The builder is cached during the creation of the conditional expression.

CONDITIONAL_STATE_OBJECT_PROPERTYback to summary
public static final String CONDITIONAL_STATE_OBJECT_PROPERTY

Notifies the conditional expression property has changed.

conditionalStateObjectback to summary
private StateObject conditionalStateObject

The state object representing the composition of the conditional expressions.

Constructor Detail

AbstractConditionalClauseStateObjectback to summary
protected AbstractConditionalClauseStateObject(StateObject parent)

Creates a new AbstractConditionalClauseStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
AbstractConditionalClauseStateObjectback to summary
protected AbstractConditionalClauseStateObject(StateObject parent, StateObject conditionalStateObject)

Creates a new AbstractConditionalClauseStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

conditionalStateObject:StateObject

The StateObject representing the conditional expression

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

addChildrenback to summary
protected void addChildren(List<StateObject> children)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.

Parameters
children:List<StateObject>

The list used to store the children

Annotations
@Override
andParseback to summary
public AndExpressionStateObject andParse(String jpqlFragment)

Parses the given JPQL fragment as the right side of an AND expression. The current conditional expression will become the left side of the AND expression.

Parameters
jpqlFragment:String

The portion of the query representing the right side of the AND expression

Returns:AndExpressionStateObject

The newly created AndExpressionStateObject

getBuilderback to summary
public IConditionalExpressionStateObjectBuilder getBuilder()

Creates and returns a new IConditionalExpressionStateObjectBuilder that can be used to programmatically create a conditional expression and once the expression is complete, IConditionalExpressionStateObjectBuilder#commit() will push the StateObject representation of that expression as this clause's conditional expression.

Returns:IConditionalExpressionStateObjectBuilder

A new builder that can be used to quickly create a conditional expression

getConditionalback to summary
public StateObject getConditional()

Returns the state object representing the composition of the conditional expressions.

Returns:StateObject

The actual conditional expression

getIdentifierback to summary
public abstract String getIdentifier()

Returns the JPQL identifier of this clause.

Returns:String

The JPQL identifier of this conditional clause

hasConditionalback to summary
public boolean hasConditional()

Determines whether the StateObject representing the conditional expression is present or not.

Returns:boolean

true if the conditional expression is not null; false otherwise

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Parameters
stateObject:StateObject

The StateObject to compare its content to this one

Returns:boolean

true if both object are equivalent; false otherwise

Annotations
@Override
orParseback to summary
public OrExpressionStateObject orParse(String jpqlFragment)

Parses the given JPQL fragment as the right side of an OR expression. The current conditional expression will become the left side of the OR expression.

Parameters
jpqlFragment:String

The portion of the query representing the right side of the OR expression

Returns:OrExpressionStateObject

The newly created OrExpressionStateObject

parseback to summary
public void parse(String jpqlFragment)

Parses the given JPQL fragment, which represents a conditional expression, and creates the StateObject.

Parameters
jpqlFragment:String

The portion of the query representing a conditional expression

setConditionalback to summary
public void setConditional(StateObject conditionalStateObject)

Sets the given StateObject to be the conditional expression of this clause.

Parameters
conditionalStateObject:StateObject

The new StateObject representing the conditional expression

shouldEncapsulateORExpressionback to summary
protected boolean shouldEncapsulateORExpression(StateObject stateObject)
toTextInternalback to summary
protected void toTextInternal(Appendable writer) throws IOException

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Parameters
writer:Appendable

The writer used to print out the string representation

Annotations
@Override
Exceptions
IOException:
This should never happens, it is only required because Appendable is used instead of any concrete class