public class InMemoryExpressionFactory extends Object implements ExpressionFactory
| Constructor and Description |
|---|
InMemoryExpressionFactory() |
| Modifier and Type | Method and Description |
|---|---|
Value |
abs(Value val)
Return a value representing the absolute value of the given one.
|
Value |
add(Value val1,
Value val2)
Return a value representing the two values added together.
|
Value |
all(Value val)
Return an expression representing the given condition.
|
Expression |
and(Expression exp1,
Expression exp2)
Return the two expressions AND'd together.
|
Value |
any(Value val)
Return an expression representing the given condition.
|
Expression |
asExpression(Value v)
Return the given value as an expression.
|
Value |
avg(Value val)
Return the average of the given value for all matches.
|
Expression |
bindKeyVariable(Value var,
Value val)
Bind the given variable to the key set of the given map value.
|
Expression |
bindValueVariable(Value var,
Value val)
Bind the given variable to the value set of the given map value.
|
Expression |
bindVariable(Value var,
Value val)
Bind the given variable to the given collection value.
|
Value |
cast(Value val,
Class cls)
Cast the value to the given class.
|
Value |
coalesceExpression(Value[] val)
Return a coalesce expression
|
Value |
concat(Value val1,
Value val2)
Return a value representing the concatenation of
the given target with the given args.
|
Expression |
contains(Value v1,
Value v2)
Return an expression representing the given condition.
|
Expression |
containsKey(Value v1,
Value v2)
Return an expression representing the given condition.
|
Expression |
containsValue(Value v1,
Value v2)
Return an expression representing the given condition.
|
Value |
count(Value val)
Return the count of the given value for all matches.
|
List |
distinct(QueryExpressions exps,
boolean fromExtent,
List matches)
Filter the given list of matches, removing duplicate entries.
|
Value |
distinct(Value val)
Return distinct values of the given value.
|
Value |
divide(Value val1,
Value val2)
Return a value representing the first value divided by the first one.
|
Expression |
emptyExpression()
Return a blank expression; this is used when the filter is empty.
|
Expression |
endsWith(Value v1,
Value v2)
Return whether the first string ends with the second.
|
Expression |
equal(Value v1,
Value v2)
Return an expression representing the given condition.
|
Value |
generalCaseExpression(Expression[] exp,
Value val)
Return a general case expression
|
<T extends Date> |
getCurrentDate(Class<T> dateType)
Return a value representing the current date.
|
<T extends Date> |
getCurrentTime(Class<T> dateType)
Return a value representing the current time.
|
<T extends Date> |
getCurrentTimestamp(Class<T> dateType)
Return a value representing the current timestamp.
|
Value |
getKey(Value val)
Path navigation thru map key
|
Value |
getMapValue(Value map,
Value arg)
Return an expression representing the given condition.
|
Value |
getNull()
Return a value representing null.
|
Value |
getObjectId(Value val)
Return the object id of the given value.
|
Value |
getThis()
Return a value representing
this. |
Expression |
greaterThan(Value v1,
Value v2)
Return an expression representing the given condition.
|
Expression |
greaterThanEqual(Value v1,
Value v2)
Return an expression representing the given condition.
|
List |
group(QueryExpressions exps,
List matches,
StoreContext ctx,
Object[] params)
Group the list of matches into a list of lists.
|
Value |
index(Value val)
Return an index/position of the given value within a collection/map.
|
Value |
indexOf(Value val1,
Value val2)
Return a value representing the indexOf (LOCATE in JPQL) function on
the given target with the given args.
|
Expression |
isEmpty(Value v1)
Return an expression representing the given condition.
|
Expression |
isInstance(Value v1,
Class c)
Return whether the first value is an instance of the given class.
|
Expression |
isNotEmpty(Value v1)
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.
|
Expression |
lessThan(Value v1,
Value v2)
Return an expression representing the given condition.
|
Expression |
lessThanEqual(Value v1,
Value v2)
Return an expression representing the given condition.
|
Value |
mapEntry(Value key,
Value val)
Return the map entry of the given value.
|
Value |
mapKey(Value key,
Value val)
Return the map key of the given value
|
protected boolean |
matches(Exp exp,
Object candidate,
StoreContext ctx,
Object[] params,
int i)
Recursive method to evaluate the expression for all possible
combinations of unbound variables.
|
boolean |
matches(QueryExpressions exps,
ClassMetaData type,
boolean subs,
Object candidate,
StoreContext ctx,
Object[] params)
Tests whether the given candidate matches the given type and this
expression.
|
boolean |
matches(QueryExpressions exps,
Collection group,
StoreContext ctx,
Object[] params)
Return true if the given group matches the having expression.
|
Expression |
matches(Value v1,
Value v2,
String single,
String multi,
String esc)
Return whether the string matches the matching pattern.
|
Value |
max(Value val)
Return the max of the given value for all matches.
|
Value |
min(Value val)
Return the max of the given value for all matches.
|
Value |
mod(Value val1,
Value val2)
Return a value representing the first value mod'd by the second one.
|
Value |
multiply(Value val1,
Value val2)
Return a value representing the two values multiplied together.
|
Value |
newAggregate(AggregateListener listener,
Value arg)
Return the value of the given function.
|
Arguments |
newArgumentList(Value... values)
Return a function argument list consisting of the given values, any
of which may itself be an argument list.
|
Arguments |
newArgumentList(Value val1,
Value val2)
Return a function argument list consisting of the given values, either
of which may itself be an argument list.
|
Value |
newBoundVariable(String name,
Class type)
This method will be called only once per variable bound in a
contains clause, and the returned value will be reused
for any further instances of the variable in subexpression of the
filter string. |
Parameter |
newCollectionValuedParameter(Object name,
Class type)
Return a value representing a collection-valued parameter.
|
Value |
newExtension(FilterListener listener,
Value target,
Value arg)
Return the value of the given extension.
|
Value |
newFunction(String functionName,
Class<?> resultType,
Value... args)
Return a value representing the given datastore function with the given arguments.
|
Literal |
newLiteral(Object val,
int parseType)
|
Parameter |
newParameter(Object name,
Class type)
Return a value representing a parameter for the given value.
|
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.
|
Path |
newPath(Value val)
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.
|
Subquery |
newSubquery(ClassMetaData candidate,
boolean subs,
String alias)
Return a subquery.
|
Literal |
newTypeLiteral(Object val,
int parseType)
|
Value |
newUnboundVariable(String name,
Class type)
Return an unbound variable.
|
Expression |
not(Expression exp)
Return the inverse of this expression.
|
Expression |
notEqual(Value v1,
Value v2)
Return an expression representing the given condition.
|
Expression |
notMatches(Value v1,
Value v2,
String single,
String multi,
String esc)
Return whether the string does not match the given pattern.
|
Value |
nullIfExpression(Value val1,
Value val2)
Return a nullif expression
|
Expression |
or(Expression exp1,
Expression exp2)
Return the two expressions OR'd together.
|
List |
order(QueryExpressions exps,
List matches,
StoreContext ctx,
Object[] params)
Order the given list of matches on the given value.
|
List |
project(QueryExpressions exps,
List matches,
StoreContext ctx,
Object[] params)
Create the projections for the given results.
|
Value |
simpleCaseExpression(Value caseOperand,
Expression[] exp,
Value val)
Return a simple case expression
|
Value |
size(Value val)
Return an expression representing the given condition.
|
Value |
sqrt(Value val)
Return the square root of the given value.
|
Expression |
startsWith(Value v1,
Value v2)
Return whether the first string starts with the second.
|
Value |
stringLength(Value str)
Returns the number of characters in the String value.
|
Value |
substring(Value val1,
Value val2)
Return a value representing the substring function on
the given target with the given args.
|
Value |
subtract(Value val1,
Value val2)
Return a value representing the second value subtracted from the first.
|
Value |
sum(Value val)
Return the max of the given value for all matches.
|
Value |
toLowerCase(Value val)
Return the upper case of the given value.
|
Value |
toUpperCase(Value val)
Return the upper case of the given value.
|
Value |
trim(Value str,
Value trimChar,
Boolean where)
Trims the specified specified trimChar from the specified value.
|
Value |
type(Value val)
Return the type/class of the given value.
|
Expression |
whenCondition(Expression exp,
Value val)
Return a when condidional clause
|
Expression |
whenScalar(Value val1,
Value val2)
Return a when scalar_expression clause
|
public boolean matches(QueryExpressions exps, ClassMetaData type, boolean subs, Object candidate, StoreContext ctx, Object[] params)
protected boolean matches(Exp exp, Object candidate, StoreContext ctx, Object[] params, int i)
public List group(QueryExpressions exps, List matches, StoreContext ctx, Object[] params)
public boolean matches(QueryExpressions exps, Collection group, StoreContext ctx, Object[] params)
public List project(QueryExpressions exps, List matches, StoreContext ctx, Object[] params)
public List order(QueryExpressions exps, List matches, StoreContext ctx, Object[] params)
public List distinct(QueryExpressions exps, boolean fromExtent, List matches)
public Expression emptyExpression()
ExpressionFactoryemptyExpression in interface ExpressionFactorypublic Expression asExpression(Value v)
ExpressionFactoryasExpression in interface ExpressionFactorypublic Expression equal(Value v1, Value v2)
ExpressionFactoryequal in interface ExpressionFactorypublic Expression notEqual(Value v1, Value v2)
ExpressionFactorynotEqual in interface ExpressionFactorypublic Expression lessThan(Value v1, Value v2)
ExpressionFactorylessThan in interface ExpressionFactorypublic Expression greaterThan(Value v1, Value v2)
ExpressionFactorygreaterThan in interface ExpressionFactorypublic Expression lessThanEqual(Value v1, Value v2)
ExpressionFactorylessThanEqual in interface ExpressionFactorypublic Expression greaterThanEqual(Value v1, Value v2)
ExpressionFactorygreaterThanEqual in interface ExpressionFactorypublic Expression isEmpty(Value v1)
ExpressionFactoryisEmpty in interface ExpressionFactorypublic Expression isNotEmpty(Value v1)
ExpressionFactoryisNotEmpty in interface ExpressionFactorypublic Expression contains(Value v1, Value v2)
ExpressionFactorycontains in interface ExpressionFactorypublic Expression containsKey(Value v1, Value v2)
ExpressionFactorycontainsKey in interface ExpressionFactorypublic Expression containsValue(Value v1, Value v2)
ExpressionFactorycontainsValue in interface ExpressionFactorypublic Value getMapValue(Value map, Value arg)
ExpressionFactorygetMapValue in interface ExpressionFactorypublic Expression isInstance(Value v1, Class c)
ExpressionFactoryisInstance in interface ExpressionFactorypublic Expression and(Expression exp1, Expression exp2)
ExpressionFactoryand in interface ExpressionFactorypublic Expression or(Expression exp1, Expression exp2)
ExpressionFactoryor in interface ExpressionFactorypublic Expression not(Expression exp)
ExpressionFactorynot in interface ExpressionFactorypublic Expression bindVariable(Value var, Value val)
ExpressionFactorybindVariable in interface ExpressionFactorypublic Expression bindKeyVariable(Value var, Value val)
ExpressionFactorybindKeyVariable in interface ExpressionFactorypublic Expression bindValueVariable(Value var, Value val)
ExpressionFactorybindValueVariable in interface ExpressionFactorypublic Expression endsWith(Value v1, Value v2)
ExpressionFactoryendsWith in interface ExpressionFactorypublic Expression matches(Value v1, Value v2, String single, String multi, String esc)
ExpressionFactorymatches in interface ExpressionFactoryv1 - the value to comparev2 - the pattern against which to comparesingle - the token that signifies a single-character matchmulti - the token that signifies a multi-character matchesc - the escape token that escapes the matching tokenspublic Expression notMatches(Value v1, Value v2, String single, String multi, String esc)
ExpressionFactorynotMatches in interface ExpressionFactoryv1 - the value to comparev2 - the pattern against which to comparesingle - the token that signifies a single-character matchmulti - the token that signifies a multi-character matchesc - the escape token that escapes the matching tokenspublic Expression startsWith(Value v1, Value v2)
ExpressionFactorystartsWith in interface ExpressionFactorypublic Subquery newSubquery(ClassMetaData candidate, boolean subs, String alias)
ExpressionFactoryExpressionFactory.newPath(Value), passing in the subquery as the
value.newSubquery in interface ExpressionFactorycandidate - the candidate class of the subquerysubs - whether the query includes subclassesalias - the alias given to the query candidate classpublic Path newPath()
ExpressionFactoryparent.address.citynewPath in interface ExpressionFactorypublic Path newPath(Value val)
ExpressionFactoryvar.address.citynewPath in interface ExpressionFactorypublic Literal newLiteral(Object val, int parseType)
ExpressionFactoryNumber, String, or Boolean instance.newLiteral in interface ExpressionFactorypublic Literal newTypeLiteral(Object val, int parseType)
ExpressionFactoryNumber, String, or Boolean instance.newTypeLiteral in interface ExpressionFactorypublic Value getThis()
ExpressionFactorythis.getThis in interface ExpressionFactorypublic Value getNull()
ExpressionFactorygetNull in interface ExpressionFactorypublic <T extends Date> Value getCurrentDate(Class<T> dateType)
ExpressionFactorygetCurrentDate in interface ExpressionFactorypublic <T extends Date> Value getCurrentTime(Class<T> dateType)
ExpressionFactorygetCurrentTime in interface ExpressionFactorypublic <T extends Date> Value getCurrentTimestamp(Class<T> dateType)
ExpressionFactorygetCurrentTimestamp in interface ExpressionFactorypublic Parameter newParameter(Object name, Class type)
ExpressionFactoryObject if the parameter is not declared.newParameter in interface ExpressionFactorypublic Parameter newCollectionValuedParameter(Object name, Class type)
ExpressionFactoryObject if the parameter is not declared.newCollectionValuedParameter in interface ExpressionFactorypublic Value newExtension(FilterListener listener, Value target, Value arg)
ExpressionFactorynewExtension in interface ExpressionFactorypublic Value newAggregate(AggregateListener listener, Value arg)
ExpressionFactorynewAggregate in interface ExpressionFactorypublic Arguments newArgumentList(Value val1, Value val2)
ExpressionFactorynewArgumentList in interface ExpressionFactorypublic Arguments newArgumentList(Value... values)
ExpressionFactorynewArgumentList in interface ExpressionFactorypublic Value newUnboundVariable(String name, Class type)
ExpressionFactoryObject
if the variable is not declared.newUnboundVariable in interface ExpressionFactorypublic Value newBoundVariable(String name, Class type)
ExpressionFactorycontains clause, and the returned value will be reused
for any further instances of the variable in subexpression of the
filter string. The type may be Object if the variable is
not declared.newBoundVariable in interface ExpressionFactorypublic Value cast(Value val, Class cls)
ExpressionFactorycast in interface ExpressionFactorypublic Value add(Value val1, Value val2)
ExpressionFactoryadd in interface ExpressionFactorypublic Value subtract(Value val1, Value val2)
ExpressionFactorysubtract in interface ExpressionFactorypublic Value multiply(Value val1, Value val2)
ExpressionFactorymultiply in interface ExpressionFactorypublic Value divide(Value val1, Value val2)
ExpressionFactorydivide in interface ExpressionFactorypublic Value mod(Value val1, Value val2)
ExpressionFactorymod in interface ExpressionFactorypublic Value abs(Value val)
ExpressionFactoryabs in interface ExpressionFactorypublic Value indexOf(Value val1, Value val2)
ExpressionFactoryindexOf in interface ExpressionFactorypublic Value concat(Value val1, Value val2)
ExpressionFactoryconcat in interface ExpressionFactorypublic Value stringLength(Value str)
ExpressionFactorystringLength in interface ExpressionFactorypublic Value trim(Value str, Value trimChar, Boolean where)
ExpressionFactorytrim in interface ExpressionFactorystr - 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 trailingpublic Value sqrt(Value val)
ExpressionFactorysqrt in interface ExpressionFactorypublic Value substring(Value val1, Value val2)
ExpressionFactoryString.substring(int),
the start index is one-based, and the second argument is the length.substring in interface ExpressionFactorypublic Value toUpperCase(Value val)
ExpressionFactorytoUpperCase in interface ExpressionFactorypublic Value toLowerCase(Value val)
ExpressionFactorytoLowerCase in interface ExpressionFactorypublic Value avg(Value val)
ExpressionFactoryavg in interface ExpressionFactorypublic Value count(Value val)
ExpressionFactorycount in interface ExpressionFactorypublic Value distinct(Value val)
ExpressionFactorydistinct in interface ExpressionFactorypublic Value max(Value val)
ExpressionFactorymax in interface ExpressionFactorypublic Value min(Value val)
ExpressionFactorymin in interface ExpressionFactorypublic Value sum(Value val)
ExpressionFactorysum in interface ExpressionFactorypublic Value any(Value val)
ExpressionFactoryany in interface ExpressionFactorypublic Value all(Value val)
ExpressionFactoryall in interface ExpressionFactorypublic Value size(Value val)
ExpressionFactorysize in interface ExpressionFactorypublic Value index(Value val)
ExpressionFactoryindex in interface ExpressionFactorypublic Value type(Value val)
ExpressionFactorytype in interface ExpressionFactorypublic Value mapEntry(Value key, Value val)
ExpressionFactorymapEntry in interface ExpressionFactorypublic Value mapKey(Value key, Value val)
ExpressionFactorymapKey in interface ExpressionFactorypublic Value getKey(Value val)
ExpressionFactorygetKey in interface ExpressionFactorypublic Value getObjectId(Value val)
ExpressionFactorygetObjectId in interface ExpressionFactorypublic Value generalCaseExpression(Expression[] exp, Value val)
ExpressionFactorygeneralCaseExpression in interface ExpressionFactorypublic Value simpleCaseExpression(Value caseOperand, Expression[] exp, Value val)
ExpressionFactorysimpleCaseExpression in interface ExpressionFactorypublic Expression whenCondition(Expression exp, Value val)
ExpressionFactorywhenCondition in interface ExpressionFactorypublic Expression whenScalar(Value val1, Value val2)
ExpressionFactorywhenScalar in interface ExpressionFactorypublic Value coalesceExpression(Value[] val)
ExpressionFactorycoalesceExpression in interface ExpressionFactorypublic Value nullIfExpression(Value val1, Value val2)
ExpressionFactorynullIfExpression in interface ExpressionFactorypublic Value newFunction(String functionName, Class<?> resultType, Value... args)
ExpressionFactorynewFunction in interface ExpressionFactorypublic boolean isVerticalType(Value val)
ExpressionFactoryisVerticalType in interface ExpressionFactoryCopyright © 2006–2022 Apache Software Foundation. All rights reserved.