Package org.apache.openjpa.kernel.exps
Interface ExpressionFactory
- All Known Implementing Classes:
InMemoryExpressionFactory
,JDBCExpressionFactory
public interface ExpressionFactory
The ExpressionFactory must be implemented by a particular runtime
to form
Expression
s in its native query language.- Author:
- Abe White
-
Method Summary
Modifier and TypeMethodDescriptionReturn a value representing the absolute value of the given one.Return a value representing the two values added together.Return an expression representing the given condition.and
(Expression exp1, Expression exp2) Return the two expressions AND'd together.Return an expression representing the given condition.asExpression
(Value bool) Return the given value as an expression.Return the average of the given value for all matches.bindKeyVariable
(Value var, Value map) Bind the given variable to the key set of the given map value.bindValueVariable
(Value var, Value map) Bind the given variable to the value set of the given map value.bindVariable
(Value var, Value coll) Bind the given variable to the given collection value.Cast the value to the given class.coalesceExpression
(Value[] val) Return a coalesce expressionReturn a value representing the concatenation of the given target with the given args.Return an expression representing the given condition.containsKey
(Value map, Value arg) Return an expression representing the given condition.containsValue
(Value map, Value arg) Return an expression representing the given condition.Return the count of the given value for all matches.Return distinct values of the given value.Return a value representing the first value divided by the first one.Return a blank expression; this is used when the filter is empty.Return whether the first string ends with the second.Return an expression representing the given condition.generalCaseExpression
(Expression[] exp, Value val) Return a general case expressiongetCurrentDate
(Class<T> dateType) Return a value representing the current date.getCurrentTime
(Class<T> timeType) Return a value representing the current time.getCurrentTimestamp
(Class<T> timestampType) Return a value representing the current timestamp.Path navigation thru map keygetMapValue
(Value map, Value arg) Return an expression representing the given condition.getNull()
Return a value representing null.getObjectId
(Value val) Return the object id of the given value.getThis()
Return a value representingthis
.greaterThan
(Value v1, Value v2) Return an expression representing the given condition.greaterThanEqual
(Value v1, Value v2) Return an expression representing the given condition.Return an index/position of the given value within a collection/map.Return a value representing the indexOf (LOCATE in JPQL) function on the given target with the given args.Return an expression representing the given condition.isInstance
(Value obj, Class c) Return whether the first value is an instance of the given class.isNotEmpty
(Value target) Return an expression representing the given condition.boolean
isVerticalType
(Value val) Return true if the Value is a Type expression and the Type uses joined table strategy.Return an expression representing the given condition.lessThanEqual
(Value v1, Value v2) Return an expression representing the given condition.Return the map entry of the given value.Return the map key of the given valueReturn whether the string matches the matching pattern.Return the max of the given value for all matches.Return the max of the given value for all matches.Return a value representing the first value mod'd by the second one.Return a value representing the two values multiplied together.newAggregate
(AggregateListener listener, Value args) Return the value of the given function.newArgumentList
(Value... values) Return a function argument list consisting of the given values, any of which may itself be an argument list.newArgumentList
(Value arg1, Value arg2) Return a function argument list consisting of the given values, either of which may itself be an argument list.newBoundVariable
(String name, Class type) This method will be called only once per variable bound in acontains
clause, and the returned value will be reused for any further instances of the variable in subexpression of the filter string.newCollectionValuedParameter
(Object name, Class type) Return a value representing a collection-valued parameter.newExtension
(FilterListener listener, Value target, Value args) Return the value of the given extension.newFunction
(String functionName, Class<?> resultType, Value... args) Return a value representing the given datastore function with the given arguments.newLiteral
(Object val, int parseType) newParameter
(Object name, Class type) Return a value representing a parameter for the given value.newPath()
Return a value representing a path which will consist of a chain of 1 or more field names starting in the namespace of the candidate class.
Example:parent.address.city
Return a value representing a path which will consist of a chain of 1 or more field names starting in the namespace of the given value.
Example:var.address.city
newSubquery
(ClassMetaData candidate, boolean subs, String alias) Return a subquery.newTypeLiteral
(Object val, int parseType) newUnboundVariable
(String name, Class type) Return an unbound variable.not
(Expression exp) Return the inverse of this expression.Return an expression representing the given condition.Return whether the string does not match the given pattern.nullIfExpression
(Value val1, Value val2) Return a nullif expressionor
(Expression exp1, Expression exp2) Return the two expressions OR'd together.simpleCaseExpression
(Value caseOperand, Expression[] exp, Value val) Return a simple case expressionReturn an expression representing the given condition.Return the square root of the given value.startsWith
(Value str1, Value str2) Return whether the first string starts with the second.stringLength
(Value str) Returns the number of characters in the String value.Return a value representing the substring function on the given target with the given args.Return a value representing the second value subtracted from the first.Return the max of the given value for all matches.toLowerCase
(Value str) Return the upper case of the given value.toUpperCase
(Value str) Return the upper case of the given value.Trims the specified specified trimChar from the specified value.Return the type/class of the given value.whenCondition
(Expression exp, Value val) Return a when condidional clausewhenScalar
(Value val1, Value val2) Return a when scalar_expression clause
-
Method Details
-
emptyExpression
Expression emptyExpression()Return a blank expression; this is used when the filter is empty. -
asExpression
Return the given value as an expression. -
equal
Return an expression representing the given condition. -
notEqual
Return an expression representing the given condition. -
lessThan
Return an expression representing the given condition. -
greaterThan
Return an expression representing the given condition. -
lessThanEqual
Return an expression representing the given condition. -
greaterThanEqual
Return an expression representing the given condition. -
isEmpty
Return an expression representing the given condition. -
isNotEmpty
Return an expression representing the given condition. -
contains
Return an expression representing the given condition. -
containsKey
Return an expression representing the given condition. -
containsValue
Return an expression representing the given condition. -
getMapValue
Return an expression representing the given condition. -
isInstance
Return whether the first value is an instance of the given class. -
and
Return the two expressions AND'd together. -
or
Return the two expressions OR'd together. -
not
Return the inverse of this expression. -
bindVariable
Bind the given variable to the given collection value. -
bindKeyVariable
Bind the given variable to the key set of the given map value. -
bindValueVariable
Bind the given variable to the value set of the given map value. -
endsWith
Return whether the first string ends with the second. -
matches
Return whether the string matches the matching pattern.- Parameters:
str
- the value to compareregexp
- the pattern against which to comparesingle
- the token that signifies a single-character matchmulti
- the token that signifies a multi-character matchescape
- the escape token that escapes the matching tokens
-
notMatches
Return whether the string does not match the given pattern.- Parameters:
str
- the value to compareregexp
- the pattern against which to comparesingle
- the token that signifies a single-character matchmulti
- the token that signifies a multi-character matchescape
- the escape token that escapes the matching tokens
-
startsWith
Return whether the first string starts with the second. -
stringLength
Returns the number of characters in the String value. -
trim
Trims the specified specified trimChar from the specified value.- Parameters:
str
- the value from which to trimtrimChar
- the characters to trim offwhere
- which side of the String to trim: null indicates both sides, true indicates leading, and false indicates trailing
-
newSubquery
Return a subquery. Paths for the candidates of the subquery are created withnewPath(Value)
, passing in the subquery as the value.- Parameters:
candidate
- the candidate class of the subquerysubs
- whether the query includes subclassesalias
- the alias given to the query candidate class
-
newPath
Path newPath()Return a value representing a path which will consist of a chain of 1 or more field names starting in the namespace of the candidate class.
Example:parent.address.city
-
newPath
Return a value representing a path which will consist of a chain of 1 or more field names starting in the namespace of the given value.
Example:var.address.city
-
newLiteral
-
getThis
Value getThis()Return a value representingthis
. -
getNull
Value getNull()Return a value representing null. -
getCurrentDate
Return a value representing the current date. -
getCurrentTime
Return a value representing the current time. -
getCurrentTimestamp
Return a value representing the current timestamp. -
newParameter
Return a value representing a parameter for the given value. The type may beObject
if the parameter is not declared. -
newCollectionValuedParameter
Return a value representing a collection-valued parameter. The type may beObject
if the parameter is not declared. -
newExtension
Return the value of the given extension. -
newAggregate
Return the value of the given function. -
newArgumentList
Return a function argument list consisting of the given values, either of which may itself be an argument list. -
newArgumentList
Return a function argument list consisting of the given values, any of which may itself be an argument list. -
newUnboundVariable
Return an unbound variable. This method will only be called once for a given named unbound variable. The type may beObject
if the variable is not declared. -
newBoundVariable
This method will be called only once per variable bound in acontains
clause, and the returned value will be reused for any further instances of the variable in subexpression of the filter string. The type may beObject
if the variable is not declared. -
cast
Cast the value to the given class. -
add
Return a value representing the two values added together. -
subtract
Return a value representing the second value subtracted from the first. -
multiply
Return a value representing the two values multiplied together. -
divide
Return a value representing the first value divided by the first one. -
mod
Return a value representing the first value mod'd by the second one. -
abs
Return a value representing the absolute value of the given one. -
indexOf
Return a value representing the indexOf (LOCATE in JPQL) function on the given target with the given args. The optional second argument is one-based. -
concat
Return a value representing the concatenation of the given target with the given args. -
sqrt
Return the square root of the given value. -
substring
Return a value representing the substring function on the given target with the given args. Unlike as withString.substring(int)
, the start index is one-based, and the second argument is the length. -
toUpperCase
Return the upper case of the given value. -
toLowerCase
Return the upper case of the given value. -
avg
Return the average of the given value for all matches. -
count
Return the count of the given value for all matches. -
max
Return the max of the given value for all matches. -
min
Return the max of the given value for all matches. -
sum
Return the max of the given value for all matches. -
any
Return an expression representing the given condition.- Since:
- 0.4.0.0
-
all
Return an expression representing the given condition.- Since:
- 0.4.0.0
-
size
Return an expression representing the given condition.- Since:
- 0.4.0.0
-
index
Return an index/position of the given value within a collection/map.- Since:
- 2.0.0
-
type
Return the type/class of the given value.- Since:
- 2.0.0
-
mapEntry
Return the map entry of the given value.- Since:
- 2.0.0
-
mapKey
Return the map key of the given value -
getKey
Path navigation thru map key -
distinct
Return distinct values of the given value. This is typically used within aggregates, for example: max(distinct(path))- Since:
- 0.4.0.0
-
getObjectId
Return the object id of the given value. -
simpleCaseExpression
Return a simple case expression -
generalCaseExpression
Return a general case expression -
whenCondition
Return a when condidional clause -
whenScalar
Return a when scalar_expression clause -
coalesceExpression
Return a coalesce expression -
nullIfExpression
Return a nullif expression -
newTypeLiteral
-
newFunction
Return a value representing the given datastore function with the given arguments. -
isVerticalType
Return true if the Value is a Type expression and the Type uses joined table strategy.
-