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

public abstract Class AbstractJPQLQueryBuilder

extends Object
implements IJPQLQueryBuilder
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.EclipseLinkJPQLQueryBuilder, org.eclipse.persistence.jpa.jpql.tools.model.JPQLQueryBuilder1_0, org.eclipse.persistence.jpa.jpql.tools.model.JPQLQueryBuilder2_0, org.eclipse.persistence.jpa.jpql.tools.model.JPQLQueryBuilder2_1
Imports
org.eclipse.persistence.jpa.jpql.parser.*, org.eclipse.persistence.jpa.jpql.tools.model.query.JPQLQueryStateObject, .StateObject, org.eclipse.persistence.jpa.jpql.tools.spi.IManagedTypeProvider

An abstract implementation of IJPQLQueryBuilder that parses a JPQL query or any JPQL fragments and creates the StateObject representation by delegating the creation to an instance of BasicStateObjectBuilder.
Author
Pascal Filion
Since
2.4
Version
2.4
See Also
DefaultJPQLQueryBuilder, EclipseLinkJPQLQueryBuilder

Field Summary

Modifier and TypeField and Description
private BasicStateObjectBuilder
builder

Keeps a reference for future use.

Constructor Summary

AccessConstructor and Description
protected
AbstractJPQLQueryBuilder()

Creates a new AbstractJPQLQueryBuilder.

Method Summary

Modifier and TypeMethod and Description
public ICaseExpressionStateObjectBuilder
buildCaseExpressionStateObjectBuilder(StateObject
The StateObject that will be the parent of the newly created model
parent
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildCaseExpressionStateObjectBuilder.

Creates a builder that can create a CASE expression programmatically.
public JPQLQueryStateObject
buildStateObject(IManagedTypeProvider
The provider of managed types
provider
,
CharSequence
The JPQL query to parse into a StateObject model
jpqlQuery
,
boolean
Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
tolerant
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Creates a state model representation of a JPQL query that can be edited.
public JPQLQueryStateObject
buildStateObject(IManagedTypeProvider
The provider of managed types
provider
,
CharSequence
The JPQL query to parse into a StateObject model
jpqlQuery
,
String
The unique identifier of the query BNF that will be used to parse the fragment
queryBNFId
,
boolean
Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
tolerant
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Creates a state model representation of a JPQL query that can be edited.
public StateObject
buildStateObject(StateObject
The StateObject that will be the parent of the newly created model
parent
,
CharSequence
A portion of a JPQL query that will be parsed and the StateObject representation will be created
jpqlFragment
,
String
The unique identifier of the query BNF that will be used to parse the fragment
queryBNFId
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Creates a StateObject representation of the given JPQL fragment.
protected abstract BasicStateObjectBuilder

Returns:

The builder that will be visiting the Expression
buildStateObjectBuilder
()

Creates the builder that creates the StateObject for each Expression.

protected final BasicStateObjectBuilder

Returns:

The builder that will be visiting the Expression
getStateObjectBuilder
()

Returns the builder that creates the StateObject for each Expression.

protected JPQLExpression

Returns:

The root of the parsed tree representation of the JPQL query
parse
(CharSequence
The string representation of the JPQL query to parse
jpqlQuery
,
JPQLGrammar
The JPQL grammar that defines how to parse a JPQL query
jpqlGrammar
,
boolean
Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
tolerant
)

Parses the given JPQL query with tolerant mode turned on.

protected JPQLExpression

Returns:

The root of the parsed tree representation of the JPQL fragment
parse
(CharSequence
The string representation of the portion of a JPQL query to parse
jpqFragment
,
JPQLGrammar
The JPQL grammar that defines how to parse a JPQL query
jpqlGrammar
,
String
The unique identifier of the JPQLQueryBNF
queryBNFId
)

Parses the given JPQL fragment with tolerant mode turned on.

protected ExpressionVisitor

Returns:

By default the given builder is returned
wrap
(BasicStateObjectBuilder
The builder to wrap
builder
)

If a subclass needs to wrap the given BasicStateObjectBuilder with another visitor can do so by simply overriding this method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

builderback to summary
private BasicStateObjectBuilder builder

Keeps a reference for future use.

Constructor Detail

AbstractJPQLQueryBuilderback to summary
protected AbstractJPQLQueryBuilder()

Creates a new AbstractJPQLQueryBuilder.

Method Detail

buildCaseExpressionStateObjectBuilderback to summary
public ICaseExpressionStateObjectBuilder buildCaseExpressionStateObjectBuilder(StateObject parent)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildCaseExpressionStateObjectBuilder.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildCaseExpressionStateObjectBuilder.

Creates a builder that can create a CASE expression programmatically. Once the expression is complete, ICaseExpressionStateObjectBuilder#buildStateObject() will return the result.

Parameters
parent:StateObject

The StateObject that will be the parent of the newly created model

Returns:ICaseExpressionStateObjectBuilder

The builder of a CASE expression

Annotations
@Override
buildStateObjectback to summary
public JPQLQueryStateObject buildStateObject(IManagedTypeProvider provider, CharSequence jpqlQuery, boolean tolerant)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Creates a state model representation of a JPQL query that can be edited.

Parameters
provider:IManagedTypeProvider

The provider of managed types

jpqlQuery:CharSequence

The JPQL query to parse into a StateObject model

tolerant:boolean

Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries

Returns:JPQLQueryStateObject

The root of the StateObject model that represents the edited form of the JPQL query

Annotations
@Override
buildStateObjectback to summary
public JPQLQueryStateObject buildStateObject(IManagedTypeProvider provider, CharSequence jpqlQuery, String queryBNFId, boolean tolerant)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Creates a state model representation of a JPQL query that can be edited.

Parameters
provider:IManagedTypeProvider

The provider of managed types

jpqlQuery:CharSequence

The JPQL query to parse into a StateObject model

queryBNFId:String

The unique identifier of the query BNF that will be used to parse the fragment

tolerant:boolean

Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries

Returns:JPQLQueryStateObject

The root of the StateObject model that represents the edited form of the JPQL query

Annotations
@Override
buildStateObjectback to summary
public StateObject buildStateObject(StateObject parent, CharSequence jpqlFragment, String queryBNFId)

Implements org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder.buildStateObject.

Creates a StateObject representation of the given JPQL fragment. In order to properly parse the fragment, the given unique identifier of the JPQLQueryBNF will determine how to parse it.

It is possible the given JPQL fragment has more than one expression, in this case, parsing should stop at the first comma (x, y) or space (x y) where x and y are two separate expressions.

Parameters
parent:StateObject

The StateObject that will be the parent of the newly created model

jpqlFragment:CharSequence

A portion of a JPQL query that will be parsed and the StateObject representation will be created

queryBNFId:String

The unique identifier of the query BNF that will be used to parse the fragment

Returns:StateObject

The StateObject representation of the given JPQL fragment

Annotations
@Override
buildStateObjectBuilderback to summary
protected abstract BasicStateObjectBuilder buildStateObjectBuilder()

Creates the builder that creates the StateObject for each Expression.

Returns:BasicStateObjectBuilder

The builder that will be visiting the Expression

getStateObjectBuilderback to summary
protected final BasicStateObjectBuilder getStateObjectBuilder()

Returns the builder that creates the StateObject for each Expression.

Returns:BasicStateObjectBuilder

The builder that will be visiting the Expression

parseback to summary
protected JPQLExpression parse(CharSequence jpqlQuery, JPQLGrammar jpqlGrammar, boolean tolerant)

Parses the given JPQL query with tolerant mode turned on.

Parameters
jpqlQuery:CharSequence

The string representation of the JPQL query to parse

jpqlGrammar:JPQLGrammar

The JPQL grammar that defines how to parse a JPQL query

tolerant:boolean

Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries

Returns:JPQLExpression

The root of the parsed tree representation of the JPQL query

parseback to summary
protected JPQLExpression parse(CharSequence jpqFragment, JPQLGrammar jpqlGrammar, String queryBNFId)

Parses the given JPQL fragment with tolerant mode turned on.

Parameters
jpqFragment:CharSequence

The string representation of the portion of a JPQL query to parse

jpqlGrammar:JPQLGrammar

The JPQL grammar that defines how to parse a JPQL query

queryBNFId:String

The unique identifier of the JPQLQueryBNF

Returns:JPQLExpression

The root of the parsed tree representation of the JPQL fragment

wrapback to summary
protected ExpressionVisitor wrap(BasicStateObjectBuilder builder)

If a subclass needs to wrap the given BasicStateObjectBuilder with another visitor can do so by simply overriding this method. buildStateObjectBuilder() can't be easily overridden with an ExpressionVisitor due to the constraint on the return type.

Parameters
builder:BasicStateObjectBuilder

The builder to wrap

Returns:ExpressionVisitor

By default the given builder is returned