|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject org.eclipse.persistence.jpa.jpql.model.query.JPQLQueryStateObject
public class JPQLQueryStateObject
This is the root of the StateObject
hierarchy that represents a JPQL query. The only
child of this state object is one of the three possible query statements.
DeleteStatementStateObject
,
SelectStatementStateObject
,
UpdateStatementStateObject
,
JPQLExpression
Field Summary | |
---|---|
static java.lang.String |
QUERY_STATEMENT_PROPERTY
Notifies the query statement has changed. |
Constructor Summary | |
---|---|
JPQLQueryStateObject(IJPQLQueryBuilder queryBuilder,
IManagedTypeProvider provider)
Creates a new JPQLQueryStateObject . |
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. |
DeleteStatementStateObject |
addDeleteStatement()
Changes the query statement to be a DELETE statement. |
SelectStatementStateObject |
addDistinctSelectStatement()
Changes the query statement to be a SELECT statement. |
SelectStatementStateObject |
addSelectStatement()
Changes the query statement to be a SELECT statement. |
SelectStatementStateObject |
addSelectStatement(java.lang.String jpqlFragment)
Changes the query statement to be a SELECT statement. |
UpdateStatementStateObject |
addUpdateStatement()
Changes the query statement to be a UPDATE statement. |
UpdateStatementStateObject |
addUpdateStatement(java.lang.String jpqlFragment)
Changes the query statement to be a UPDATE statement. |
protected StateObject |
checkParent(StateObject parent)
Checks whether the given parent is null or not. |
DeclarationStateObject |
getDeclaration()
Returns the declaration clause which defines the domain of the query by declaring identification variables. |
JPQLExpression |
getExpression()
Returns the actual parsed object if this StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
JPQLGrammar |
getGrammar()
Returns the grammar that defines how to parse a JPQL query. |
IManagedTypeProvider |
getManagedTypeProvider()
Returns the provider of managed types. |
StateObject |
getParent()
Returns the parent of this StateObject . |
IJPQLQueryBuilder |
getQueryBuilder()
Returns the IJPQLQueryBuilder that is responsible to create various part of the StateObject hierarchy. |
StateObject |
getQueryStatement()
Returns the only child of this state object, which represents one of the three query statement. |
JPQLQueryStateObject |
getRoot()
Returns the root of the StateObject hierarchy. |
boolean |
hasQueryStatement()
Determines whether a query statement has been defined. |
protected void |
initialize(IJPQLQueryBuilder queryBuilder,
IManagedTypeProvider provider)
Initializes this JPQLQueryStateObject . |
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.CharSequence jpqlFragment,
java.lang.String queryBNFId)
Parses the given JPQL fragment as this state object's query statement. |
void |
setExpression(JPQLExpression 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 |
setQueryStatement(StateObject queryStatement)
Sets the only child of this state object, which represents one of the three query statement. |
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. |
Methods inherited from class org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject |
---|
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDecorator, getType, getType, getTypeHelper, getTypeRepository, hashCode, initialize, 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 |
Field Detail |
---|
public static final java.lang.String QUERY_STATEMENT_PROPERTY
Constructor Detail |
---|
public JPQLQueryStateObject(IJPQLQueryBuilder queryBuilder, IManagedTypeProvider provider)
JPQLQueryStateObject
.
queryBuilder
- The builder that can create any StateObject
for any given JPQL
fragment when using a parse methodprovider
- The external form of a provider that gives access to the JPA metadata
java.lang.NullPointerException
- If one of the given arguments is 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 AbstractStateObject
children
- The list used to store the childrenpublic DeleteStatementStateObject addDeleteStatement()
DELETE
statement.
DELETE
statementpublic SelectStatementStateObject addDistinctSelectStatement()
SELECT
statement. The SELECT
clause will have the DISTINCT
identifier set.
SELECT
statementpublic SelectStatementStateObject addSelectStatement()
SELECT
statement.
SELECT
statementpublic SelectStatementStateObject addSelectStatement(java.lang.String jpqlFragment)
SELECT
statement.
jpqlFragment
- The portion of the query representing the select items, excluding the
SELECT
identifier
SELECT
statementpublic UpdateStatementStateObject addUpdateStatement()
UPDATE
statement.
UPDTE
statementpublic UpdateStatementStateObject addUpdateStatement(java.lang.String jpqlFragment)
UPDATE
statement.
jpqlFragment
- The portion of the query representing the select items, excluding the
UPDATE
identifier
UPDATE
statementprotected StateObject checkParent(StateObject parent)
null
or not. If it's null
then
throw a NullPointerException
.
checkParent
in class AbstractStateObject
parent
- The parent of this state object
public DeclarationStateObject getDeclaration()
getDeclaration
in interface StateObject
getDeclaration
in class AbstractStateObject
StateObject
is 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 subquerypublic JPQLExpression getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.
getExpression
in interface StateObject
getExpression
in class AbstractStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public JPQLGrammar getGrammar()
getGrammar
in interface StateObject
getGrammar
in class AbstractStateObject
public IManagedTypeProvider getManagedTypeProvider()
getManagedTypeProvider
in interface StateObject
getManagedTypeProvider
in class AbstractStateObject
public StateObject getParent()
StateObject
.
getParent
in interface StateObject
getParent
in class AbstractStateObject
StateObject
, which is null
only when
this is the root of the hierarchypublic IJPQLQueryBuilder getQueryBuilder()
IJPQLQueryBuilder
that is responsible to create various part of the StateObject
hierarchy.
getQueryBuilder
in interface StateObject
getQueryBuilder
in class AbstractStateObject
StateObject
from a JPQL query or that gives
access to various sub-builderspublic StateObject getQueryStatement()
public JPQLQueryStateObject getRoot()
StateObject
hierarchy.
getRoot
in interface StateObject
getRoot
in class AbstractStateObject
public boolean hasQueryStatement()
true
if there is a query statement defined; false
otherwiseprotected void initialize(IJPQLQueryBuilder queryBuilder, IManagedTypeProvider provider)
JPQLQueryStateObject
.
queryBuilder
- The builder that can create any StateObject
for any given JPQL fragmentprovider
- The external form that gives access to the JPA metadata
java.lang.NullPointerException
- If one of the given arguments is null
public 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 AbstractStateObject
stateObject
- The StateObject
to compare its content to this one
true
if both object are equivalent; false
otherwisepublic void parse(java.lang.CharSequence jpqlFragment, java.lang.String queryBNFId)
jpqlFragment
- The portion of the query to parsequeryBNFId
- The unique identifier of the BNF that determines how to parse the fragmentpublic void setExpression(JPQLExpression 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 the JPQL querypublic void setQueryStatement(StateObject queryStatement)
queryStatement
- The state object representing the query statement, which was created
based on the query typeprotected 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 representation
java.io.IOException
- This should never happens, it is only required because Appendable
is used instead of any concrete class
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |