Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.parser

public abstract Class ExpressionFactory

extends Object
implements Comparable<ExpressionFactory>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.parser.ExtractExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.FromClauseFactory, org.eclipse.persistence.jpa.jpql.parser.FunctionExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.GeneralIdentificationExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.GroupByClauseFactory, org.eclipse.persistence.jpa.jpql.parser.GroupByItemFactory, org.eclipse.persistence.jpa.jpql.parser.HavingClauseFactory, org.eclipse.persistence.jpa.jpql.parser.HierarchicalQueryClauseFactory, org.eclipse.persistence.jpa.jpql.parser.IdentificationVariableDeclarationFactory, org.eclipse.persistence.jpa.jpql.parser.IdentificationVariableFactory, org.eclipse.persistence.jpa.jpql.parser.IndexExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.InExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.InternalOrderByItemFactory, org.eclipse.persistence.jpa.jpql.parser.IsExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.JoinFactory, org.eclipse.persistence.jpa.jpql.parser.KeywordExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.LengthExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.LikeExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.LocalDateTypeFactory, org.eclipse.persistence.jpa.jpql.parser.LocalExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.LocateExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.LowerExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.MathExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.MaxFunctionFactory, org.eclipse.persistence.jpa.jpql.parser.MinFunctionFactory, org.eclipse.persistence.jpa.jpql.parser.ModExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.NotExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.NullIfExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.ObjectExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.OnClauseFactory, org.eclipse.persistence.jpa.jpql.parser.OrderByClauseFactory, org.eclipse.persistence.jpa.jpql.parser.OrderByItemFactory, org.eclipse.persistence.jpa.jpql.parser.OrderSiblingsByClauseFactory, org.eclipse.persistence.jpa.jpql.parser.OrExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.RangeDeclarationFactory, org.eclipse.persistence.jpa.jpql.parser.RangeVariableDeclarationFactory, org.eclipse.persistence.jpa.jpql.parser.RegexpExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.ResultVariableFactory, org.eclipse.persistence.jpa.jpql.parser.SelectStatementFactory, org.eclipse.persistence.jpa.jpql.parser.SimpleSelectStatementFactory, org.eclipse.persistence.jpa.jpql.parser.SizeExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.SqrtExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.StartWithClauseFactory, org.eclipse.persistence.jpa.jpql.parser.StringLiteralFactory, org.eclipse.persistence.jpa.jpql.parser.SubstringExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.SumFunctionFactory, org.eclipse.persistence.jpa.jpql.parser.TableExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.TableVariableDeclarationFactory, org.eclipse.persistence.jpa.jpql.parser.TreatExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.TrimExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.TypeExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.UnionClauseFactory, org.eclipse.persistence.jpa.jpql.parser.UnknownExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.UpdateClauseFactory, org.eclipse.persistence.jpa.jpql.parser.UpdateItemFactory, org.eclipse.persistence.jpa.jpql.parser.UpdateItemStateFieldPathExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.UpdateStatementFactory, org.eclipse.persistence.jpa.jpql.parser.UpperExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.WhenClauseFactory, org.eclipse.persistence.jpa.jpql.parser.WhereClauseFactory, org.eclipse.persistence.jpa.jpql.parser.AbsExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.AbstractLiteralExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.AbstractSchemaNameFactory, org.eclipse.persistence.jpa.jpql.parser.AllOrAnyExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.AndExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.ArithmeticExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.AsOfClauseFactory, org.eclipse.persistence.jpa.jpql.parser.BadExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.BetweenExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.CaseExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.AvgFunctionFactory, org.eclipse.persistence.jpa.jpql.parser.ConstructorExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.SelectClauseFactory, org.eclipse.persistence.jpa.jpql.parser.CastExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.CoalesceExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.CollectionMemberDeclarationFactory, org.eclipse.persistence.jpa.jpql.parser.CollectionMemberExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.ComparisonExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.ConcatExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.ConnectByClauseFactory, org.eclipse.persistence.jpa.jpql.parser.CountFunctionFactory, org.eclipse.persistence.jpa.jpql.parser.DatabaseTypeFactory, org.eclipse.persistence.jpa.jpql.parser.DateTimeFactory, org.eclipse.persistence.jpa.jpql.parser.DeleteClauseFactory, org.eclipse.persistence.jpa.jpql.parser.DeleteStatementFactory, org.eclipse.persistence.jpa.jpql.parser.EntryExpressionFactory, org.eclipse.persistence.jpa.jpql.parser.ExistsExpressionFactory
Annotations
@SuppressWarnings:nls
Imports
java.util.Arrays, org.eclipse.persistence.jpa.jpql.WordParser

An ExpressionFactory is responsible to parse a portion of JPQL query which starts with one of the factory's JPQL identifiers.

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Modifier and TypeField and Description
private ExpressionRegistry
expressionRegistry

The ExpressionRegistry with which this ExpressionFactory was registered.

private final String
id

The unique identifier of this ExpressionFactory.

private String[]
identifiers

The JPQL identifiers handled by this factory.

Constructor Summary

AccessConstructor and Description
protected
ExpressionFactory(String
The unique identifier of this ExpressionFactory
id
,
String...
The JPQL identifiers handled by this factory
identifiers
)

Creates a new ExpressionFactory.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addIdentifier(String
The JPQL identifier this factory will parse
identifier
)

Adds the given JPQL identifier to this factory.

pack-priv void
addIdentifiers(String...
The JPQL identifiers this factory will parse
identifiers
)

Adds the given JPQL identifiers to this factory.

protected abstract AbstractExpression

Returns:

A new AbstractExpression representing the portion or the totality of the text held by WordParser starting at the cursor position
buildExpression
(AbstractExpression parent, WordParser
The text to parse based on the current position of the cursor
wordParser
,
String
The current word being parsed
word
,
JPQLQueryBNF
The BNF grammar that was used to identifier this factory to be capable to parse a portion of the query
queryBNF
,
AbstractExpression
During the parsing, it is possible the first part of an expression was parsed which needs to be used as a sub-expression of the newly created expression
expression
,
boolean tolerant)

Creates a new Expression.

public final int
compareTo(ExpressionFactory
the object to be compared.
expressionFactory
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public final boolean
equals(Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public final ExpressionRegistry

Returns:

The registry containing the information related to the JPQL grammar
getExpressionRegistry
()

Returns the registry containing the JPQLQueryBNFs and the ExpressionFactories that are used to properly parse a JPQL query.

public final String

Returns:

The identifier used to register this ExpressionFactory with ExpressionRegistry
getId
()

Returns the unique identifier of this ExpressionFactory.

public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public final String[]

Returns:

The list of JPQL identifiers this factory knows how to parse
identifiers
()

Returns the JPQL identifiers handled by this factory.

pack-priv final void
setExpressionRegistry(ExpressionRegistry
The registry for a given JPQL grammar
expressionRegistry
)

Sets the backpointer to the ExpressionRegistry with which this JPQLQueryBNF was registered.

public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

expressionRegistryback to summary
private ExpressionRegistry expressionRegistry

The ExpressionRegistry with which this ExpressionFactory was registered.

idback to summary
private final String id

The unique identifier of this ExpressionFactory.

identifiersback to summary
private String[] identifiers

The JPQL identifiers handled by this factory.

Constructor Detail

ExpressionFactoryback to summary
protected ExpressionFactory(String id, String... identifiers)

Creates a new ExpressionFactory.

Parameters
id:String

The unique identifier of this ExpressionFactory

identifiers:String[]

The JPQL identifiers handled by this factory

Exceptions
NullPointerException:
The given unique identifier cannot be null or the list of JPQL identifiers was null

Method Detail

addIdentifierback to summary
pack-priv void addIdentifier(String identifier)

Adds the given JPQL identifier to this factory.

Parameters
identifier:String

The JPQL identifier this factory will parse

addIdentifiersback to summary
pack-priv void addIdentifiers(String... identifiers)

Adds the given JPQL identifiers to this factory.

Parameters
identifiers:String[]

The JPQL identifiers this factory will parse

buildExpressionback to summary
protected abstract AbstractExpression buildExpression(AbstractExpression parent, WordParser wordParser, String word, JPQLQueryBNF queryBNF, AbstractExpression expression, boolean tolerant)

Creates a new Expression.

Parameters
parent:AbstractExpression

The parent AbstractExpression

wordParser:WordParser

The text to parse based on the current position of the cursor

word:String

The current word being parsed

queryBNF:JPQLQueryBNF

The BNF grammar that was used to identifier this factory to be capable to parse a portion of the query

expression:AbstractExpression

During the parsing, it is possible the first part of an expression was parsed which needs to be used as a sub-expression of the newly created expression

Returns:AbstractExpression

A new AbstractExpression representing the portion or the totality of the text held by WordParser starting at the cursor position

compareToback to summary
public final int compareTo(ExpressionFactory expressionFactory)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
expressionFactory:ExpressionFactory

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
equalsback to summary
public final boolean equals(Object object)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
object:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getExpressionRegistryback to summary
public final ExpressionRegistry getExpressionRegistry()

Returns the registry containing the JPQLQueryBNFs and the ExpressionFactories that are used to properly parse a JPQL query.

Returns:ExpressionRegistry

The registry containing the information related to the JPQL grammar

getIdback to summary
public final String getId()

Returns the unique identifier of this ExpressionFactory.

Returns:String

The identifier used to register this ExpressionFactory with ExpressionRegistry

hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
identifiersback to summary
public final String[] identifiers()

Returns the JPQL identifiers handled by this factory.

Returns:String[]

The list of JPQL identifiers this factory knows how to parse

setExpressionRegistryback to summary
pack-priv final void setExpressionRegistry(ExpressionRegistry expressionRegistry)

Sets the backpointer to the ExpressionRegistry with which this JPQLQueryBNF was registered.

Parameters
expressionRegistry:ExpressionRegistry

The registry for a given JPQL grammar

toStringback to summary
public final String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override