|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject<WhenClauseStateObject>
org.eclipse.persistence.jpa.jpql.tools.model.query.CaseExpressionStateObject
public class CaseExpressionStateObject
A CASE predicate is used to calculate a condition and when it's true,
its THEN expression will be executed.
general_case_expression ::= CASE when_clause {when_clause}* ELSE scalar_expression END
or
simple_case_expression ::= CASE case_operand simple_when_clause {simple_when_clause}* ELSE scalar_expression END
WhenClauseStateObject,
CaseExpression| Field Summary | |
|---|---|
static java.lang.String |
CASE_OPERAND_STATE_OBJECT_PROPERTY
Notify the StateObject representing the case operand that follows the
CASE identifier has changed. |
static java.lang.String |
ELSE_STATE_OBJECT_PROPERTY
Notify the StateObject representing the else expression that follows the
ELSE identifier has changed. |
static java.lang.String |
WHEN_CLAUSE_STATE_OBJECT_LIST
Notify the list of StateObjects representing the when clauses that
follow the WHEN has changed. |
| Constructor Summary | |
|---|---|
CaseExpressionStateObject(StateObject parent)
Creates a new CaseExpressionStateObject. |
|
CaseExpressionStateObject(StateObject parent,
java.util.List<WhenClauseStateObject> whenClauseStateObjects,
StateObject elseStateObject)
Creates a new CaseExpressionStateObject. |
|
CaseExpressionStateObject(StateObject parent,
StateObject caseOperandStateObject,
java.util.List<WhenClauseStateObject> whenClauseStateObjects,
StateObject elseStateObject)
Creates a new CaseExpressionStateObject. |
|
| Method Summary | |
|---|---|
void |
accept(StateObjectVisitor visitor)
Visits this StateObject by the given visitor. |
protected void |
addChildren(java.util.List<StateObject> children)
Adds the children of this StateObject to the given list. |
protected void |
addProblems(java.util.List<Problem> problems)
Adds to the given list the problems that were found with the current state of this StateObject, which means there are validation issues. |
WhenClauseStateObject |
addWhenClause()
Adds a new WHEN clause. |
WhenClauseStateObject |
addWhenClause(StateObject whenStateObject,
StateObject thenStateObject)
Adds the given two StateObjects as the WHEN expression and
the THEN expression of the new WHEN clause. |
WhenClauseStateObject |
addWhenClause(java.lang.String whenJpqlFragment,
java.lang.String thenJpqlFragment)
Adds the given two StateObjects as the WHEN expression and
the THEN expression of the new WHEN clause. |
StateObject |
getCaseOperand()
Returns the StateObject representing the case operand. |
StateObject |
getElse()
Returns the StateObject representing the ELSE scalar expression. |
CaseExpression |
getExpression()
Returns the actual parsed object if this StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
boolean |
hasCaseOperand()
Determines whether the StateObject representing the case operand is present. |
boolean |
hasElse()
Determines whether the StateObject representing the ELSE scalar
expression is present. |
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
protected java.lang.String |
listName()
Returns the name that is uniquely identifying the list. |
void |
parseCaseOperand(java.lang.String jpqlFragment)
Parses the given JPQL fragment, which will represent the case operand. |
void |
parseElse(java.lang.String jpqlFragment)
Parses the given JPQL fragment, which will represent the ELSE expression. |
void |
removeCaseOperand()
Removes the case operand. |
void |
setCaseOperand(StateObject caseOperand)
Sets the case operand to be the given StateObject. |
void |
setElse(StateObject elseStateObject)
Sets the ELSE scalar expression to be the given StateObject. |
void |
setExpression(CaseExpression expression)
Keeps a reference of the parsed object object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects. |
void |
toTextInternal(java.lang.Appendable writer)
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. |
| Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject |
|---|
addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItems |
| Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject |
|---|
acceptUnknownVisitor, acceptUnknownVisitor, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject |
|---|
addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText |
| Field Detail |
|---|
public static final java.lang.String CASE_OPERAND_STATE_OBJECT_PROPERTY
StateObject representing the case operand that follows the
CASE identifier has changed.
public static final java.lang.String ELSE_STATE_OBJECT_PROPERTY
StateObject representing the else expression that follows the
ELSE identifier has changed.
public static final java.lang.String WHEN_CLAUSE_STATE_OBJECT_LIST
StateObjects representing the when clauses that
follow the WHEN has changed.
| Constructor Detail |
|---|
public CaseExpressionStateObject(StateObject parent)
CaseExpressionStateObject.
parent - The parent of this state object, which cannot be null
java.lang.NullPointerException - The given parent cannot be nullpublic CaseExpressionStateObject(StateObject parent, java.util.List<WhenClauseStateObject> whenClauseStateObjects, StateObject elseStateObject)
CaseExpressionStateObject.
parent - The parent of this state object, which cannot be nullwhenClauseStateObjects - The list of WhenClauseStateObjects
that are representing the WHEN clauseselseStateObject - The StateObject representing the scalar expression that is
following the ELSE identifier
java.lang.NullPointerException - The given parent cannot be nullpublic CaseExpressionStateObject(StateObject parent, StateObject caseOperandStateObject, java.util.List<WhenClauseStateObject> whenClauseStateObjects, StateObject elseStateObject)
CaseExpressionStateObject.
parent - The parent of this state object, which cannot be nullcaseOperandStateObject - The StateObject representing the case operand that is
following the CASE identifier or null if none is declaredwhenClauseStateObjects - The list of WhenClauseStateObjects
that are representing the WHEN clauseselseStateObject - The StateObject representing the scalar expression that is
following the ELSE identifier
java.lang.NullPointerException - The given parent cannot be null| Method Detail |
|---|
public void accept(StateObjectVisitor visitor)
StateObject by the given visitor.
visitor - The visitor to visit this objectprotected void addChildren(java.util.List<StateObject> children)
StateObject to the given list.
addChildren in class AbstractListHolderStateObject<WhenClauseStateObject>children - The list used to store the childrenprotected void addProblems(java.util.List<Problem> problems)
StateObject, which means there are validation issues.
addProblems in class AbstractStateObjectproblems - The list to which the problems are addedpublic WhenClauseStateObject addWhenClause()
WHEN clause.
WhenClauseStateObjectpublic WhenClauseStateObject addWhenClause(StateObject whenStateObject, StateObject thenStateObject)
StateObjects as the WHEN expression and
the THEN expression of the new WHEN clause.
whenStateObject - The StateObject representing the WHEN
expressionthenStateObject - The StateObject representing the THEN
expression
WhenClauseStateObjectpublic WhenClauseStateObject addWhenClause(java.lang.String whenJpqlFragment, java.lang.String thenJpqlFragment)
StateObjects as the WHEN expression and
the THEN expression of the new WHEN clause.
whenJpqlFragment - The string representation of the WHEN to parse and
to convert into a StateObject representationthenJpqlFragment - The string representation of the THEN to parse and
to convert into a StateObject representation
WhenClauseStateObjectpublic StateObject getCaseOperand()
StateObject representing the case operand.
StateObject representing the case operand or null if it is
not presentpublic StateObject getElse()
StateObject representing the ELSE scalar expression.
StateObject representing the ELSE scalar expression
or null if it is not presentpublic CaseExpression getExpression()
StateObject representation of the JPQL query
was created by parsing an existing JPQL query.
getExpression in interface StateObjectgetExpression in class AbstractStateObjectStateObject
or null when the JPQL query is manually created (i.e. not from a string)public boolean hasCaseOperand()
StateObject representing the case operand is present.
true the case operand exists; otherwise falsepublic boolean hasElse()
StateObject representing the ELSE scalar
expression is present.
true the ELSE scalar expression exists; otherwise
falsepublic boolean isEquivalent(StateObject stateObject)
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same.
isEquivalent in interface StateObjectisEquivalent in class AbstractStateObjectstateObject - The StateObject to compare its content to this one
true if both object are equivalent; false otherwiseprotected java.lang.String listName()
listName in class AbstractListHolderStateObject<WhenClauseStateObject>public void parseCaseOperand(java.lang.String jpqlFragment)
jpqlFragment - The string representation of the case operand to parse and to convert into
a StateObject representationpublic void parseElse(java.lang.String jpqlFragment)
ELSE expression.
The JPQL fragment should not start with the identifier.
jpqlFragment - The string representation of the ELSE to parse and to
convert into a StateObject representationpublic void removeCaseOperand()
public void setCaseOperand(StateObject caseOperand)
StateObject.
caseOperand - The StateObject representing the case operand or
null to remove itpublic void setElse(StateObject elseStateObject)
ELSE scalar expression to be the given StateObject.
elseStateObject - The StateObject representing the ELSE
scalar expression or null to remove itpublic void setExpression(CaseExpression expression)
parsed object object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects.
expression - The parsed object representing a CASE
expression
public void toTextInternal(java.lang.Appendable writer)
throws java.io.IOException
StateObject, which should not be used to
define a true string representation of a JPQL query but should be used for
debugging purposes.
toTextInternal in class AbstractStateObjectwriter - The writer used to print out the string representation
java.io.IOException - This should never happens, it is only required because Appendable
is used instead of any concrete class
|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||