public class SimpleSelectClauseStateObject extends AbstractSelectClauseStateObject
simple_select_clause ::= SELECT [DISTINCT] simple_select_expression
SimpleSelectClause
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SELECT_ITEM_PROPERTY
Notifies the select expression property has changed.
|
DISTINCT_PROPERTY
Constructor and Description |
---|
SimpleSelectClauseStateObject(SimpleSelectStatementStateObject parent)
Creates a new
SubQuerySelectClauseStateObject . |
Modifier and Type | Method and Description |
---|---|
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. |
ISimpleSelectExpressionStateObjectBuilder |
getBuilder()
Creates and returns a new
ISimpleSelectExpressionStateObjectBuilder that can be used
to programmatically create a single select expression and once the expression is complete,
ISimpleSelectExpressionStateObjectBuilder.commit() will push the StateObject
representation of that expression as this clause's select expression. |
SimpleSelectClause |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
SimpleFromClauseStateObject |
getFromClause()
Returns the
AbstractFromClauseStateObject representing the FROM clause. |
SimpleSelectStatementStateObject |
getParent()
Returns the parent of this
StateObject . |
StateObject |
getSelectItem()
Returns
|
boolean |
hasSelectItem()
Determines whether this
SELECT clause has a select item defined (only one
can be set for a subquery's SELECT clause and many for a top-level query). |
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
void |
parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment and create the select item.
|
void |
setExpression(SimpleSelectClause 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 |
setSelectItem(StateObject stateObject)
Sets the given
StateObject as this clause's select item. |
protected 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. |
hasDistinct, setDistinct, toggleDistinct
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, initialize, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
public static final java.lang.String SELECT_ITEM_PROPERTY
public SimpleSelectClauseStateObject(SimpleSelectStatementStateObject parent)
SubQuerySelectClauseStateObject
.parent
- The parent of this state object, which cannot be null
java.lang.NullPointerException
- The given parent cannot be null
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 AbstractStateObject
children
- The list used to store the childrenpublic ISimpleSelectExpressionStateObjectBuilder getBuilder()
ISimpleSelectExpressionStateObjectBuilder
that can be used
to programmatically create a single select expression and once the expression is complete,
ISimpleSelectExpressionStateObjectBuilder.commit()
will push the StateObject
representation of that expression as this clause's select expression.public SimpleSelectClause getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.getExpression
in interface StateObject
getExpression
in class AbstractSelectClauseStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public SimpleFromClauseStateObject getFromClause()
AbstractFromClauseStateObject
representing the FROM clause.getFromClause
in class AbstractSelectClauseStateObject
public SimpleSelectStatementStateObject getParent()
StateObject
.getParent
in interface StateObject
getParent
in class AbstractSelectClauseStateObject
StateObject
, which is null
only when
this is the root of the hierarchypublic StateObject getSelectItem()
public boolean hasSelectItem()
SELECT
clause has a select item defined (only one
can be set for a subquery's SELECT
clause and many for a top-level query).hasSelectItem
in class AbstractSelectClauseStateObject
true
if this state object has children; false
otherwisepublic boolean isEquivalent(StateObject stateObject)
StateObject
is equivalent to this one, i.e. the
information of both StateObject
is the same.isEquivalent
in interface StateObject
isEquivalent
in class AbstractSelectClauseStateObject
stateObject
- The StateObject
to compare its content to this onetrue
if both object are equivalent; false
otherwisepublic void parse(java.lang.String jpqlFragment)
parse
in class AbstractSelectClauseStateObject
jpqlFragment
- The portion of the query representing one or several select itemspublic void setExpression(SimpleSelectClause 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 subquery
SELECT
clausepublic void setSelectItem(StateObject stateObject)
StateObject
as this clause's select item.stateObject
- The StateObject
representing the single select itemprotected 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 AbstractStateObject
writer
- The writer used to print out the string representationjava.io.IOException
- This should never happens, it is only required because Appendable
is used instead of any concrete class