Interface ExpressionFactory
- All Known Implementing Classes:
InMemoryExpressionFactory, JDBCExpressionFactory
public interface ExpressionFactory
The ExpressionFactory must be implemented by a particular runtime
to form
Expressions 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.Returns a value representing the ceiling value of the given one.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.Returns a value representing the Euler's e constant powered to the given value.Returns a value representing the floor of the given value.generalCaseExpression(Expression[] exp, Value val) Return a general case expressiongetCurrentDate(Class<T> dateType) Return a value representing the current date.getCurrentLocalDateTime(Class<T> temporalType) Return a value representing the current local temporal.getCurrentTime(Class<T> timeType) Return a value representing the current time.getCurrentTimestamp(Class<T> timestampType) Return a value representing the current timestamp.getDateTimeField(DateTimeExtractField field, Value value) Returns the integer or double value of the required ChronoField from the temporal valuegetDateTimePart(DateTimeExtractPart part, Value value) Return the Date or time part of the given temporal valuePath navigation thru map keygetMapValue(Value map, Value arg) Return an expression representing the given condition.getNativeObjectId(Value val) Returns the id of the given value.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.booleanisVerticalType(Value val) Return true if the Value is a Type expression and the Type uses joined table strategy.Returns a value representing the left function on the given target with the given arguments.Return an expression representing the given condition.lessThanEqual(Value v1, Value v2) Return an expression representing the given condition.Returns the natural logarithm of the given valueReturn 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 acontainsclause, 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.cityReturn 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.citynewSubquery(ClassMetaData candidate, boolean subs, String alias) Return a subquery.newTypecastAsNumber(Value value, Class<? extends Number> numberType) Returns the value typecasted as the given Number type.newTypecastAsString(Value value) Returns the value typecasted as string.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.Returns a value representing base powered by the exponentReturns the original string with the pattern replaced by the third argument.Returns a value representing the right function on the given target with the given arguments.Returns the sign of the given value as a number (-1 for negative, 0 for zeroes and 1 for positive)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.Returns the version 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
-
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
-
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
-
newLiteral
-
getThis
Value getThis()Return a value representingthis. -
getNull
Value getNull()Return a value representing null. -
getCurrentDate
-
getCurrentTime
-
getCurrentTimestamp
-
getCurrentLocalDateTime
-
getDateTimeField
Returns the integer or double value of the required ChronoField from the temporal value -
getDateTimePart
Return the Date or time part of the given temporal value -
newTypecastAsString
-
newTypecastAsNumber
-
newParameter
-
newCollectionValuedParameter
-
newExtension
Return the value of the given extension. -
newAggregate
Return the value of the given function. -
newArgumentList
-
newArgumentList
-
newUnboundVariable
-
newBoundVariable
This method will be called only once per variable bound in acontainsclause, and the returned value will be reused for any further instances of the variable in subexpression of the filter string. The type may beObjectif the variable is not declared. -
cast
-
add
-
subtract
-
multiply
-
divide
-
mod
-
abs
-
ceiling
-
exp
-
floor
-
ln
-
sign
-
power
-
round
-
indexOf
-
concat
-
sqrt
-
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. -
left
-
right
-
replace
-
toUpperCase
-
toLowerCase
-
avg
-
count
-
max
-
min
-
sum
-
any
-
all
-
size
-
index
-
type
-
mapEntry
-
mapKey
-
getKey
-
distinct
-
getObjectId
-
getNativeObjectId
-
version
-
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
-
nullIfExpression
-
newTypeLiteral
-
newFunction
-
isVerticalType
Return true if the Value is a Type expression and the Type uses joined table strategy.
-