public class JDBCExpressionFactory extends Object implements ExpressionFactory, Serializable
Constructor and Description |
---|
JDBCExpressionFactory(ClassMapping type)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Value |
abs(Value val)
Return a value representing the absolute value of the given one.
|
Value |
add(Value v1,
Value v2)
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[] vals)
Return a coalesce expression
|
Value |
concat(Value v1,
Value v2)
Return a value representing the concatenation of
the given target with the given args.
|
Expression |
contains(Value map,
Value arg)
Return an expression representing the given condition.
|
Expression |
containsKey(Value map,
Value arg)
Return an expression representing the given condition.
|
Expression |
containsValue(Value map,
Value arg)
Return an expression representing the given condition.
|
Value |
count(Value val)
Return the count of the given value for all matches.
|
Value |
distinct(Value val)
Return distinct values of the given value.
|
Value |
divide(Value v1,
Value v2)
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.
|
SelectConstructor |
getSelectConstructor()
Use to create SQL select.
|
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.
|
Value |
index(Value val)
Return an index/position of the given value within a collection/map.
|
Value |
indexOf(Value v1,
Value v2)
Return a value representing the indexOf (LOCATE in JPQL) function on
the given target with the given args.
|
Expression |
isEmpty(Value val)
Return an expression representing the given condition.
|
Expression |
isInstance(Value val,
Class c)
Return whether the first value is an instance of the given class.
|
Expression |
isNotEmpty(Value val)
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
|
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 v1,
Value v2)
Return a value representing the first value mod'd by the second one.
|
Value |
multiply(Value v1,
Value v2)
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... vs)
Return a function argument list consisting of the given values, any
of which may itself be an argument list.
|
Arguments |
newArgumentList(Value v1,
Value v2)
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 key,
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 ptype)
|
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 ptype)
|
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.
|
void |
setBooleanLiteralAsNumeric(boolean isBooleanLiteralAsNumeric) |
Value |
simpleCaseExpression(Value caseOperand,
Expression[] exp,
Value val1)
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 v1,
Value v2)
Return a value representing the substring function on
the given target with the given args.
|
Value |
subtract(Value v1,
Value v2)
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 JDBCExpressionFactory(ClassMapping type)
public void setBooleanLiteralAsNumeric(boolean isBooleanLiteralAsNumeric)
public SelectConstructor getSelectConstructor()
public Expression emptyExpression()
ExpressionFactory
emptyExpression
in interface ExpressionFactory
public Expression asExpression(Value v)
ExpressionFactory
asExpression
in interface ExpressionFactory
public Expression equal(Value v1, Value v2)
ExpressionFactory
equal
in interface ExpressionFactory
public Expression notEqual(Value v1, Value v2)
ExpressionFactory
notEqual
in interface ExpressionFactory
public Expression lessThan(Value v1, Value v2)
ExpressionFactory
lessThan
in interface ExpressionFactory
public Expression greaterThan(Value v1, Value v2)
ExpressionFactory
greaterThan
in interface ExpressionFactory
public Expression lessThanEqual(Value v1, Value v2)
ExpressionFactory
lessThanEqual
in interface ExpressionFactory
public Expression greaterThanEqual(Value v1, Value v2)
ExpressionFactory
greaterThanEqual
in interface ExpressionFactory
public Expression isEmpty(Value val)
ExpressionFactory
isEmpty
in interface ExpressionFactory
public Expression isNotEmpty(Value val)
ExpressionFactory
isNotEmpty
in interface ExpressionFactory
public Expression contains(Value map, Value arg)
ExpressionFactory
contains
in interface ExpressionFactory
public Expression containsKey(Value map, Value arg)
ExpressionFactory
containsKey
in interface ExpressionFactory
public Expression containsValue(Value map, Value arg)
ExpressionFactory
containsValue
in interface ExpressionFactory
public Expression isInstance(Value val, Class c)
ExpressionFactory
isInstance
in interface ExpressionFactory
public Expression and(Expression exp1, Expression exp2)
ExpressionFactory
and
in interface ExpressionFactory
public Expression or(Expression exp1, Expression exp2)
ExpressionFactory
or
in interface ExpressionFactory
public Expression not(Expression exp)
ExpressionFactory
not
in interface ExpressionFactory
public Expression bindVariable(Value var, Value val)
ExpressionFactory
bindVariable
in interface ExpressionFactory
public Expression bindKeyVariable(Value var, Value val)
ExpressionFactory
bindKeyVariable
in interface ExpressionFactory
public Expression bindValueVariable(Value var, Value val)
ExpressionFactory
bindValueVariable
in interface ExpressionFactory
public Expression startsWith(Value v1, Value v2)
ExpressionFactory
startsWith
in interface ExpressionFactory
public Expression endsWith(Value v1, Value v2)
ExpressionFactory
endsWith
in interface ExpressionFactory
public Expression notMatches(Value v1, Value v2, String single, String multi, String esc)
ExpressionFactory
notMatches
in interface ExpressionFactory
v1
- 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 matches(Value v1, Value v2, String single, String multi, String esc)
ExpressionFactory
matches
in interface ExpressionFactory
v1
- 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 Subquery newSubquery(ClassMetaData candidate, boolean subs, String alias)
ExpressionFactory
ExpressionFactory.newPath(Value)
, passing in the subquery as the
value.newSubquery
in interface ExpressionFactory
candidate
- the candidate class of the subquerysubs
- whether the query includes subclassesalias
- the alias given to the query candidate classpublic Path newPath()
ExpressionFactory
parent.address.city
newPath
in interface ExpressionFactory
public Path newPath(Value val)
ExpressionFactory
var.address.city
newPath
in interface ExpressionFactory
public Literal newLiteral(Object val, int ptype)
ExpressionFactory
Number
, String
, or Boolean
instance.newLiteral
in interface ExpressionFactory
public Literal newTypeLiteral(Object val, int ptype)
ExpressionFactory
Number
, String
, or Boolean
instance.newTypeLiteral
in interface ExpressionFactory
public Value getThis()
ExpressionFactory
this
.getThis
in interface ExpressionFactory
public Value getNull()
ExpressionFactory
getNull
in interface ExpressionFactory
public <T extends Date> Value getCurrentDate(Class<T> dateType)
ExpressionFactory
getCurrentDate
in interface ExpressionFactory
public <T extends Date> Value getCurrentTime(Class<T> dateType)
ExpressionFactory
getCurrentTime
in interface ExpressionFactory
public <T extends Date> Value getCurrentTimestamp(Class<T> dateType)
ExpressionFactory
getCurrentTimestamp
in interface ExpressionFactory
public Parameter newParameter(Object name, Class type)
ExpressionFactory
Object
if the parameter is not declared.newParameter
in interface ExpressionFactory
public Parameter newCollectionValuedParameter(Object key, Class type)
ExpressionFactory
Object
if the parameter is not declared.newCollectionValuedParameter
in interface ExpressionFactory
public Value newExtension(FilterListener listener, Value target, Value arg)
ExpressionFactory
newExtension
in interface ExpressionFactory
public Value newAggregate(AggregateListener listener, Value arg)
ExpressionFactory
newAggregate
in interface ExpressionFactory
public Arguments newArgumentList(Value v1, Value v2)
ExpressionFactory
newArgumentList
in interface ExpressionFactory
public Arguments newArgumentList(Value... vs)
ExpressionFactory
newArgumentList
in interface ExpressionFactory
public Value newUnboundVariable(String name, Class type)
ExpressionFactory
Object
if the variable is not declared.newUnboundVariable
in interface ExpressionFactory
public Value newBoundVariable(String name, Class type)
ExpressionFactory
contains
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 ExpressionFactory
public Value cast(Value val, Class cls)
ExpressionFactory
cast
in interface ExpressionFactory
public Value add(Value v1, Value v2)
ExpressionFactory
add
in interface ExpressionFactory
public Value subtract(Value v1, Value v2)
ExpressionFactory
subtract
in interface ExpressionFactory
public Value multiply(Value v1, Value v2)
ExpressionFactory
multiply
in interface ExpressionFactory
public Value divide(Value v1, Value v2)
ExpressionFactory
divide
in interface ExpressionFactory
public Value mod(Value v1, Value v2)
ExpressionFactory
mod
in interface ExpressionFactory
public Value abs(Value val)
ExpressionFactory
abs
in interface ExpressionFactory
public Value indexOf(Value v1, Value v2)
ExpressionFactory
indexOf
in interface ExpressionFactory
public Value concat(Value v1, Value v2)
ExpressionFactory
concat
in interface ExpressionFactory
public Value stringLength(Value str)
ExpressionFactory
stringLength
in interface ExpressionFactory
public Value trim(Value str, Value trimChar, Boolean where)
ExpressionFactory
trim
in interface ExpressionFactory
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 trailingpublic Value sqrt(Value val)
ExpressionFactory
sqrt
in interface ExpressionFactory
public Value substring(Value v1, Value v2)
ExpressionFactory
String.substring(int)
,
the start index is one-based, and the second argument is the length.substring
in interface ExpressionFactory
public Value toUpperCase(Value val)
ExpressionFactory
toUpperCase
in interface ExpressionFactory
public Value toLowerCase(Value val)
ExpressionFactory
toLowerCase
in interface ExpressionFactory
public Value avg(Value val)
ExpressionFactory
avg
in interface ExpressionFactory
public Value count(Value val)
ExpressionFactory
count
in interface ExpressionFactory
public Value distinct(Value val)
ExpressionFactory
distinct
in interface ExpressionFactory
public Value max(Value val)
ExpressionFactory
max
in interface ExpressionFactory
public Value min(Value val)
ExpressionFactory
min
in interface ExpressionFactory
public Value sum(Value val)
ExpressionFactory
sum
in interface ExpressionFactory
public Value any(Value val)
ExpressionFactory
any
in interface ExpressionFactory
public Value all(Value val)
ExpressionFactory
all
in interface ExpressionFactory
public Value size(Value val)
ExpressionFactory
size
in interface ExpressionFactory
public Value index(Value val)
ExpressionFactory
index
in interface ExpressionFactory
public Value type(Value val)
ExpressionFactory
type
in interface ExpressionFactory
public Value mapEntry(Value key, Value val)
ExpressionFactory
mapEntry
in interface ExpressionFactory
public Value mapKey(Value key, Value val)
ExpressionFactory
mapKey
in interface ExpressionFactory
public Value getKey(Value val)
ExpressionFactory
getKey
in interface ExpressionFactory
public Value getObjectId(Value val)
ExpressionFactory
getObjectId
in interface ExpressionFactory
public Value getMapValue(Value map, Value arg)
ExpressionFactory
getMapValue
in interface ExpressionFactory
public Value simpleCaseExpression(Value caseOperand, Expression[] exp, Value val1)
ExpressionFactory
simpleCaseExpression
in interface ExpressionFactory
public Value generalCaseExpression(Expression[] exp, Value val)
ExpressionFactory
generalCaseExpression
in interface ExpressionFactory
public Expression whenCondition(Expression exp, Value val)
ExpressionFactory
whenCondition
in interface ExpressionFactory
public Expression whenScalar(Value val1, Value val2)
ExpressionFactory
whenScalar
in interface ExpressionFactory
public Value coalesceExpression(Value[] vals)
ExpressionFactory
coalesceExpression
in interface ExpressionFactory
public Value nullIfExpression(Value val1, Value val2)
ExpressionFactory
nullIfExpression
in interface ExpressionFactory
public Value newFunction(String functionName, Class<?> resultType, Value... args)
ExpressionFactory
newFunction
in interface ExpressionFactory
public boolean isVerticalType(Value val)
ExpressionFactory
isVerticalType
in interface ExpressionFactory
Copyright © 2006–2020 Apache Software Foundation. All rights reserved.