GigaSpaces XAP 9.1 API

org.openspaces.jpa.openjpa.query
Class QueryExpressionFactory

java.lang.Object
  extended by org.openspaces.jpa.openjpa.query.QueryExpressionFactory
All Implemented Interfaces:
org.apache.openjpa.kernel.exps.ExpressionFactory

public class QueryExpressionFactory
extends Object
implements org.apache.openjpa.kernel.exps.ExpressionFactory

Defines the way the translated expression tree is built by OpenJPA.

Since:
8.0
Author:
idan

Constructor Summary
QueryExpressionFactory(StoreManager store)
           
 
Method Summary
 org.apache.openjpa.kernel.exps.Value abs(org.apache.openjpa.kernel.exps.Value num)
          Return a value representing the absolute value of the given one.
 org.apache.openjpa.kernel.exps.Value add(org.apache.openjpa.kernel.exps.Value num1, org.apache.openjpa.kernel.exps.Value num2)
          Return a value representing the two values added together.
 org.apache.openjpa.kernel.exps.Value all(org.apache.openjpa.kernel.exps.Value target)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression and(org.apache.openjpa.kernel.exps.Expression exp1, org.apache.openjpa.kernel.exps.Expression exp2)
          Return the two expressions AND'd together.
 org.apache.openjpa.kernel.exps.Value any(org.apache.openjpa.kernel.exps.Value target)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression asExpression(org.apache.openjpa.kernel.exps.Value bool)
          Return the given value as an expression.
 org.apache.openjpa.kernel.exps.Value avg(org.apache.openjpa.kernel.exps.Value num)
          Return the average of the given value for all matches.
 org.apache.openjpa.kernel.exps.Expression bindKeyVariable(org.apache.openjpa.kernel.exps.Value var, org.apache.openjpa.kernel.exps.Value map)
          Bind the given variable to the key set of the given map value.
 org.apache.openjpa.kernel.exps.Expression bindValueVariable(org.apache.openjpa.kernel.exps.Value var, org.apache.openjpa.kernel.exps.Value map)
          Bind the given variable to the value set of the given map value.
 org.apache.openjpa.kernel.exps.Expression bindVariable(org.apache.openjpa.kernel.exps.Value var, org.apache.openjpa.kernel.exps.Value coll)
          Bind the given variable to the given collection value.
 org.apache.openjpa.kernel.exps.Value cast(org.apache.openjpa.kernel.exps.Value obj, Class cls)
          Cast the value to the given class.
 org.apache.openjpa.kernel.exps.Value coalesceExpression(org.apache.openjpa.kernel.exps.Value[] val)
          Return a coalesce expression
 org.apache.openjpa.kernel.exps.Value concat(org.apache.openjpa.kernel.exps.Value str, org.apache.openjpa.kernel.exps.Value args)
          Return a value representing the concatenation of the given target with the given args.
 org.apache.openjpa.kernel.exps.Expression contains(org.apache.openjpa.kernel.exps.Value fieldPath, org.apache.openjpa.kernel.exps.Value value)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression containsKey(org.apache.openjpa.kernel.exps.Value map, org.apache.openjpa.kernel.exps.Value arg)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression containsValue(org.apache.openjpa.kernel.exps.Value map, org.apache.openjpa.kernel.exps.Value arg)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Value count(org.apache.openjpa.kernel.exps.Value obj)
          Return the count of the given value for all matches.
 org.apache.openjpa.kernel.exps.Value distinct(org.apache.openjpa.kernel.exps.Value obj)
          Return distinct values of the given value.
 org.apache.openjpa.kernel.exps.Value divide(org.apache.openjpa.kernel.exps.Value num1, org.apache.openjpa.kernel.exps.Value num2)
          Return a value representing the first value divided by the first one.
 org.apache.openjpa.kernel.exps.Expression emptyExpression()
          Return a blank expression; this is used when the filter is empty.
 org.apache.openjpa.kernel.exps.Expression endsWith(org.apache.openjpa.kernel.exps.Value str1, org.apache.openjpa.kernel.exps.Value str2)
          Return whether the first string ends with the second.
 org.apache.openjpa.kernel.exps.Expression equal(org.apache.openjpa.kernel.exps.Value v1, org.apache.openjpa.kernel.exps.Value v2)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Value generalCaseExpression(org.apache.openjpa.kernel.exps.Expression[] exp, org.apache.openjpa.kernel.exps.Value val)
          Return a general case expression
<T extends Date>
org.apache.openjpa.kernel.exps.Value
getCurrentDate(Class<T> dateType)
          Return a value representing the current date.
<T extends Date>
org.apache.openjpa.kernel.exps.Value
getCurrentTime(Class<T> timeType)
          Return a value representing the current time.
<T extends Date>
org.apache.openjpa.kernel.exps.Value
getCurrentTimestamp(Class<T> timestampType)
          Return a value representing the current timestamp.
 org.apache.openjpa.kernel.exps.Value getKey(org.apache.openjpa.kernel.exps.Value val)
          Path navigation thru map key
 org.apache.openjpa.kernel.exps.Value getMapValue(org.apache.openjpa.kernel.exps.Value map, org.apache.openjpa.kernel.exps.Value arg)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Value getNull()
          Return a value representing null.
 org.apache.openjpa.kernel.exps.Value getObjectId(org.apache.openjpa.kernel.exps.Value val)
          Return the object id of the given value.
 org.apache.openjpa.kernel.exps.Value getThis()
          Return a value representing this.
 org.apache.openjpa.kernel.exps.Expression greaterThan(org.apache.openjpa.kernel.exps.Value v1, org.apache.openjpa.kernel.exps.Value v2)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression greaterThanEqual(org.apache.openjpa.kernel.exps.Value v1, org.apache.openjpa.kernel.exps.Value v2)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Value index(org.apache.openjpa.kernel.exps.Value target)
          Return an index/position of the given value within a collection/map.
 org.apache.openjpa.kernel.exps.Value indexOf(org.apache.openjpa.kernel.exps.Value str, org.apache.openjpa.kernel.exps.Value args)
          Return a value representing the String.indexOf(int) function on the given target with the given args.
 org.apache.openjpa.kernel.exps.Expression isEmpty(org.apache.openjpa.kernel.exps.Value target)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression isInstance(org.apache.openjpa.kernel.exps.Value obj, Class c)
          Return whether the first value is an instance of the given class.
 org.apache.openjpa.kernel.exps.Expression isNotEmpty(org.apache.openjpa.kernel.exps.Value target)
          Return an expression representing the given condition.
 boolean isVerticalType(org.apache.openjpa.kernel.exps.Value val)
          Return true if the Value is a Type expression and the Type uses joined table strategy.
 org.apache.openjpa.kernel.exps.Expression lessThan(org.apache.openjpa.kernel.exps.Value v1, org.apache.openjpa.kernel.exps.Value v2)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression lessThanEqual(org.apache.openjpa.kernel.exps.Value v1, org.apache.openjpa.kernel.exps.Value v2)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Value mapEntry(org.apache.openjpa.kernel.exps.Value key, org.apache.openjpa.kernel.exps.Value val)
          Return the map entry of the given value.
 org.apache.openjpa.kernel.exps.Value mapKey(org.apache.openjpa.kernel.exps.Value key, org.apache.openjpa.kernel.exps.Value val)
          Return the map key of the given value
 org.apache.openjpa.kernel.exps.Expression matches(org.apache.openjpa.kernel.exps.Value str, org.apache.openjpa.kernel.exps.Value regexp, String single, String multi, String escape)
          Return whether the string matches the matching pattern.
 org.apache.openjpa.kernel.exps.Value max(org.apache.openjpa.kernel.exps.Value num)
          Return the max of the given value for all matches.
 org.apache.openjpa.kernel.exps.Value min(org.apache.openjpa.kernel.exps.Value num)
          Return the max of the given value for all matches.
 org.apache.openjpa.kernel.exps.Value mod(org.apache.openjpa.kernel.exps.Value num1, org.apache.openjpa.kernel.exps.Value num2)
          Return a value representing the first value mod'd by the second one.
 org.apache.openjpa.kernel.exps.Value multiply(org.apache.openjpa.kernel.exps.Value num1, org.apache.openjpa.kernel.exps.Value num2)
          Return a value representing the two values multiplied together.
 org.apache.openjpa.kernel.exps.Value newAggregate(org.apache.openjpa.kernel.exps.AggregateListener listener, org.apache.openjpa.kernel.exps.Value args)
          Return the value of the given function.
 org.apache.openjpa.kernel.exps.Arguments newArgumentList(org.apache.openjpa.kernel.exps.Value... values)
          Return a function argument list consisting of the given values, any of which may itself be an argument list.
 org.apache.openjpa.kernel.exps.Arguments newArgumentList(org.apache.openjpa.kernel.exps.Value arg1, org.apache.openjpa.kernel.exps.Value arg2)
          Return a function argument list consisting of the given values, either of which may itself be an argument list.
 org.apache.openjpa.kernel.exps.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.
 org.apache.openjpa.kernel.exps.Parameter newCollectionValuedParameter(Object name, Class type)
          Return a value representing a collection-valued parameter.
 org.apache.openjpa.kernel.exps.Value newExtension(org.apache.openjpa.kernel.exps.FilterListener listener, org.apache.openjpa.kernel.exps.Value target, org.apache.openjpa.kernel.exps.Value args)
          Return the value of the given extension.
 org.apache.openjpa.kernel.exps.Value newFunction(String functionName, Class<?> resultType, org.apache.openjpa.kernel.exps.Value... args)
          Return a value representing the given datastore function with the given arguments.
 org.apache.openjpa.kernel.exps.Literal newLiteral(Object val, int parseType)
          Return a value representing the given constant, which will be a Number, String, or Boolean instance.
 org.apache.openjpa.kernel.exps.Parameter newParameter(Object name, Class type)
          Return a value representing a parameter for the given value.
 org.apache.openjpa.kernel.exps.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.
 org.apache.openjpa.kernel.exps.Path newPath(org.apache.openjpa.kernel.exps.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.
 org.apache.openjpa.kernel.exps.Subquery newSubquery(org.apache.openjpa.meta.ClassMetaData candidate, boolean subs, String alias)
          Return a subquery.
 org.apache.openjpa.kernel.exps.Literal newTypeLiteral(Object val, int parseType)
          Return a value representing the given constant, which will be a Number, String, or Boolean instance.
 org.apache.openjpa.kernel.exps.Value newUnboundVariable(String name, Class type)
          Return an unbound variable.
 org.apache.openjpa.kernel.exps.Expression not(org.apache.openjpa.kernel.exps.Expression exp)
          Return the inverse of this expression.
 org.apache.openjpa.kernel.exps.Expression notEqual(org.apache.openjpa.kernel.exps.Value v1, org.apache.openjpa.kernel.exps.Value v2)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Expression notMatches(org.apache.openjpa.kernel.exps.Value str, org.apache.openjpa.kernel.exps.Value regexp, String single, String multi, String escape)
          Return whether the string does not match the given pattern.
 org.apache.openjpa.kernel.exps.Value nullIfExpression(org.apache.openjpa.kernel.exps.Value val1, org.apache.openjpa.kernel.exps.Value val2)
          Return a nullif expression
 org.apache.openjpa.kernel.exps.Expression or(org.apache.openjpa.kernel.exps.Expression exp1, org.apache.openjpa.kernel.exps.Expression exp2)
          Return the two expressions OR'd together.
 org.apache.openjpa.kernel.exps.Value simpleCaseExpression(org.apache.openjpa.kernel.exps.Value caseOperand, org.apache.openjpa.kernel.exps.Expression[] exp, org.apache.openjpa.kernel.exps.Value val)
          Return a simple case expression
 org.apache.openjpa.kernel.exps.Value size(org.apache.openjpa.kernel.exps.Value target)
          Return an expression representing the given condition.
 org.apache.openjpa.kernel.exps.Value sqrt(org.apache.openjpa.kernel.exps.Value num)
          Return the square root of the given value.
 org.apache.openjpa.kernel.exps.Expression startsWith(org.apache.openjpa.kernel.exps.Value str1, org.apache.openjpa.kernel.exps.Value str2)
          Return whether the first string starts with the second.
 org.apache.openjpa.kernel.exps.Value stringLength(org.apache.openjpa.kernel.exps.Value str)
          Returns the number of characters in the String value.
 org.apache.openjpa.kernel.exps.Value substring(org.apache.openjpa.kernel.exps.Value str, org.apache.openjpa.kernel.exps.Value args)
          Return a value representing the String.substring(int) function on the given target with the given args.
 org.apache.openjpa.kernel.exps.Value subtract(org.apache.openjpa.kernel.exps.Value num1, org.apache.openjpa.kernel.exps.Value num2)
          Return a value representing the second value subtracted from the first.
 org.apache.openjpa.kernel.exps.Value sum(org.apache.openjpa.kernel.exps.Value num)
          Return the max of the given value for all matches.
 org.apache.openjpa.kernel.exps.Value toLowerCase(org.apache.openjpa.kernel.exps.Value str)
          Return the upper case of the given value.
 org.apache.openjpa.kernel.exps.Value toUpperCase(org.apache.openjpa.kernel.exps.Value str)
          Return the upper case of the given value.
 org.apache.openjpa.kernel.exps.Value trim(org.apache.openjpa.kernel.exps.Value str, org.apache.openjpa.kernel.exps.Value trimChar, Boolean where)
          Trims the specified specified trimChar from the specified value.
 org.apache.openjpa.kernel.exps.Value type(org.apache.openjpa.kernel.exps.Value target)
          Return the type/class of the given value.
 org.apache.openjpa.kernel.exps.Expression whenCondition(org.apache.openjpa.kernel.exps.Expression exp, org.apache.openjpa.kernel.exps.Value val)
          Return a when condidional clause
 org.apache.openjpa.kernel.exps.Expression whenScalar(org.apache.openjpa.kernel.exps.Value val1, org.apache.openjpa.kernel.exps.Value val2)
          Return a when scalar_expression clause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryExpressionFactory

public QueryExpressionFactory(StoreManager store)
Method Detail

emptyExpression

public org.apache.openjpa.kernel.exps.Expression emptyExpression()
Return a blank expression; this is used when the filter is empty.

Specified by:
emptyExpression in interface org.apache.openjpa.kernel.exps.ExpressionFactory

asExpression

public org.apache.openjpa.kernel.exps.Expression asExpression(org.apache.openjpa.kernel.exps.Value bool)
Return the given value as an expression.

Specified by:
asExpression in interface org.apache.openjpa.kernel.exps.ExpressionFactory

equal

public org.apache.openjpa.kernel.exps.Expression equal(org.apache.openjpa.kernel.exps.Value v1,
                                                       org.apache.openjpa.kernel.exps.Value v2)
Return an expression representing the given condition.

Specified by:
equal in interface org.apache.openjpa.kernel.exps.ExpressionFactory

notEqual

public org.apache.openjpa.kernel.exps.Expression notEqual(org.apache.openjpa.kernel.exps.Value v1,
                                                          org.apache.openjpa.kernel.exps.Value v2)
Return an expression representing the given condition.

Specified by:
notEqual in interface org.apache.openjpa.kernel.exps.ExpressionFactory

lessThan

public org.apache.openjpa.kernel.exps.Expression lessThan(org.apache.openjpa.kernel.exps.Value v1,
                                                          org.apache.openjpa.kernel.exps.Value v2)
Return an expression representing the given condition.

Specified by:
lessThan in interface org.apache.openjpa.kernel.exps.ExpressionFactory

greaterThan

public org.apache.openjpa.kernel.exps.Expression greaterThan(org.apache.openjpa.kernel.exps.Value v1,
                                                             org.apache.openjpa.kernel.exps.Value v2)
Return an expression representing the given condition.

Specified by:
greaterThan in interface org.apache.openjpa.kernel.exps.ExpressionFactory

lessThanEqual

public org.apache.openjpa.kernel.exps.Expression lessThanEqual(org.apache.openjpa.kernel.exps.Value v1,
                                                               org.apache.openjpa.kernel.exps.Value v2)
Return an expression representing the given condition.

Specified by:
lessThanEqual in interface org.apache.openjpa.kernel.exps.ExpressionFactory

greaterThanEqual

public org.apache.openjpa.kernel.exps.Expression greaterThanEqual(org.apache.openjpa.kernel.exps.Value v1,
                                                                  org.apache.openjpa.kernel.exps.Value v2)
Return an expression representing the given condition.

Specified by:
greaterThanEqual in interface org.apache.openjpa.kernel.exps.ExpressionFactory

isEmpty

public org.apache.openjpa.kernel.exps.Expression isEmpty(org.apache.openjpa.kernel.exps.Value target)
Return an expression representing the given condition.

Specified by:
isEmpty in interface org.apache.openjpa.kernel.exps.ExpressionFactory

isNotEmpty

public org.apache.openjpa.kernel.exps.Expression isNotEmpty(org.apache.openjpa.kernel.exps.Value target)
Return an expression representing the given condition.

Specified by:
isNotEmpty in interface org.apache.openjpa.kernel.exps.ExpressionFactory

contains

public org.apache.openjpa.kernel.exps.Expression contains(org.apache.openjpa.kernel.exps.Value fieldPath,
                                                          org.apache.openjpa.kernel.exps.Value value)
Return an expression representing the given condition.

Specified by:
contains in interface org.apache.openjpa.kernel.exps.ExpressionFactory

containsKey

public org.apache.openjpa.kernel.exps.Expression containsKey(org.apache.openjpa.kernel.exps.Value map,
                                                             org.apache.openjpa.kernel.exps.Value arg)
Return an expression representing the given condition.

Specified by:
containsKey in interface org.apache.openjpa.kernel.exps.ExpressionFactory

containsValue

public org.apache.openjpa.kernel.exps.Expression containsValue(org.apache.openjpa.kernel.exps.Value map,
                                                               org.apache.openjpa.kernel.exps.Value arg)
Return an expression representing the given condition.

Specified by:
containsValue in interface org.apache.openjpa.kernel.exps.ExpressionFactory

getMapValue

public org.apache.openjpa.kernel.exps.Value getMapValue(org.apache.openjpa.kernel.exps.Value map,
                                                        org.apache.openjpa.kernel.exps.Value arg)
Return an expression representing the given condition.

Specified by:
getMapValue in interface org.apache.openjpa.kernel.exps.ExpressionFactory

isInstance

public org.apache.openjpa.kernel.exps.Expression isInstance(org.apache.openjpa.kernel.exps.Value obj,
                                                            Class c)
Return whether the first value is an instance of the given class.

Specified by:
isInstance in interface org.apache.openjpa.kernel.exps.ExpressionFactory

and

public org.apache.openjpa.kernel.exps.Expression and(org.apache.openjpa.kernel.exps.Expression exp1,
                                                     org.apache.openjpa.kernel.exps.Expression exp2)
Return the two expressions AND'd together.

Specified by:
and in interface org.apache.openjpa.kernel.exps.ExpressionFactory

or

public org.apache.openjpa.kernel.exps.Expression or(org.apache.openjpa.kernel.exps.Expression exp1,
                                                    org.apache.openjpa.kernel.exps.Expression exp2)
Return the two expressions OR'd together.

Specified by:
or in interface org.apache.openjpa.kernel.exps.ExpressionFactory

not

public org.apache.openjpa.kernel.exps.Expression not(org.apache.openjpa.kernel.exps.Expression exp)
Return the inverse of this expression.

Specified by:
not in interface org.apache.openjpa.kernel.exps.ExpressionFactory

bindVariable

public org.apache.openjpa.kernel.exps.Expression bindVariable(org.apache.openjpa.kernel.exps.Value var,
                                                              org.apache.openjpa.kernel.exps.Value coll)
Bind the given variable to the given collection value.

Specified by:
bindVariable in interface org.apache.openjpa.kernel.exps.ExpressionFactory

bindKeyVariable

public org.apache.openjpa.kernel.exps.Expression bindKeyVariable(org.apache.openjpa.kernel.exps.Value var,
                                                                 org.apache.openjpa.kernel.exps.Value map)
Bind the given variable to the key set of the given map value.

Specified by:
bindKeyVariable in interface org.apache.openjpa.kernel.exps.ExpressionFactory

bindValueVariable

public org.apache.openjpa.kernel.exps.Expression bindValueVariable(org.apache.openjpa.kernel.exps.Value var,
                                                                   org.apache.openjpa.kernel.exps.Value map)
Bind the given variable to the value set of the given map value.

Specified by:
bindValueVariable in interface org.apache.openjpa.kernel.exps.ExpressionFactory

endsWith

public org.apache.openjpa.kernel.exps.Expression endsWith(org.apache.openjpa.kernel.exps.Value str1,
                                                          org.apache.openjpa.kernel.exps.Value str2)
Return whether the first string ends with the second.

Specified by:
endsWith in interface org.apache.openjpa.kernel.exps.ExpressionFactory

matches

public org.apache.openjpa.kernel.exps.Expression matches(org.apache.openjpa.kernel.exps.Value str,
                                                         org.apache.openjpa.kernel.exps.Value regexp,
                                                         String single,
                                                         String multi,
                                                         String escape)
Return whether the string matches the matching pattern.

Specified by:
matches in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Parameters:
str - the value to compare
regexp - the pattern against which to compare
single - the token that signifies a single-character match
multi - the token that signifies a multi-character match
escape - the escape token that escapes the matching tokens

notMatches

public org.apache.openjpa.kernel.exps.Expression notMatches(org.apache.openjpa.kernel.exps.Value str,
                                                            org.apache.openjpa.kernel.exps.Value regexp,
                                                            String single,
                                                            String multi,
                                                            String escape)
Return whether the string does not match the given pattern.

Specified by:
notMatches in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Parameters:
str - the value to compare
regexp - the pattern against which to compare
single - the token that signifies a single-character match
multi - the token that signifies a multi-character match
escape - the escape token that escapes the matching tokens

startsWith

public org.apache.openjpa.kernel.exps.Expression startsWith(org.apache.openjpa.kernel.exps.Value str1,
                                                            org.apache.openjpa.kernel.exps.Value str2)
Return whether the first string starts with the second.

Specified by:
startsWith in interface org.apache.openjpa.kernel.exps.ExpressionFactory

stringLength

public org.apache.openjpa.kernel.exps.Value stringLength(org.apache.openjpa.kernel.exps.Value str)
Returns the number of characters in the String value.

Specified by:
stringLength in interface org.apache.openjpa.kernel.exps.ExpressionFactory

trim

public org.apache.openjpa.kernel.exps.Value trim(org.apache.openjpa.kernel.exps.Value str,
                                                 org.apache.openjpa.kernel.exps.Value trimChar,
                                                 Boolean where)
Trims the specified specified trimChar from the specified value.

Specified by:
trim in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Parameters:
str - the value from which to trim
trimChar - the characters to trim off
where - which side of the String to trim: null indicates both sides, true indicates leading, and false indicates trailing

newSubquery

public org.apache.openjpa.kernel.exps.Subquery newSubquery(org.apache.openjpa.meta.ClassMetaData candidate,
                                                           boolean subs,
                                                           String alias)
Return a subquery. Paths for the candidates of the subquery are created with newPath(Value), passing in the subquery as the value.

Specified by:
newSubquery in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Parameters:
candidate - the candidate class of the subquery
subs - whether the query includes subclasses
alias - the alias given to the query candidate class

newPath

public org.apache.openjpa.kernel.exps.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

Specified by:
newPath in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newPath

public org.apache.openjpa.kernel.exps.Path newPath(org.apache.openjpa.kernel.exps.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.
Example: var.address.city

Specified by:
newPath in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newLiteral

public org.apache.openjpa.kernel.exps.Literal newLiteral(Object val,
                                                         int parseType)
Return a value representing the given constant, which will be a Number, String, or Boolean instance.

Specified by:
newLiteral in interface org.apache.openjpa.kernel.exps.ExpressionFactory

getThis

public org.apache.openjpa.kernel.exps.Value getThis()
Return a value representing this.

Specified by:
getThis in interface org.apache.openjpa.kernel.exps.ExpressionFactory

getNull

public org.apache.openjpa.kernel.exps.Value getNull()
Return a value representing null.

Specified by:
getNull in interface org.apache.openjpa.kernel.exps.ExpressionFactory

getCurrentDate

public <T extends Date> org.apache.openjpa.kernel.exps.Value getCurrentDate(Class<T> dateType)
Return a value representing the current date.

Specified by:
getCurrentDate in interface org.apache.openjpa.kernel.exps.ExpressionFactory

getCurrentTime

public <T extends Date> org.apache.openjpa.kernel.exps.Value getCurrentTime(Class<T> timeType)
Return a value representing the current time.

Specified by:
getCurrentTime in interface org.apache.openjpa.kernel.exps.ExpressionFactory

getCurrentTimestamp

public <T extends Date> org.apache.openjpa.kernel.exps.Value getCurrentTimestamp(Class<T> timestampType)
Return a value representing the current timestamp.

Specified by:
getCurrentTimestamp in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newParameter

public org.apache.openjpa.kernel.exps.Parameter newParameter(Object name,
                                                             Class type)
Return a value representing a parameter for the given value. The type may be Object if the parameter is not declared.

Specified by:
newParameter in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newCollectionValuedParameter

public org.apache.openjpa.kernel.exps.Parameter newCollectionValuedParameter(Object name,
                                                                             Class type)
Return a value representing a collection-valued parameter. The type may be Object if the parameter is not declared.

Specified by:
newCollectionValuedParameter in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newExtension

public org.apache.openjpa.kernel.exps.Value newExtension(org.apache.openjpa.kernel.exps.FilterListener listener,
                                                         org.apache.openjpa.kernel.exps.Value target,
                                                         org.apache.openjpa.kernel.exps.Value args)
Return the value of the given extension.

Specified by:
newExtension in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newAggregate

public org.apache.openjpa.kernel.exps.Value newAggregate(org.apache.openjpa.kernel.exps.AggregateListener listener,
                                                         org.apache.openjpa.kernel.exps.Value args)
Return the value of the given function.

Specified by:
newAggregate in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newArgumentList

public org.apache.openjpa.kernel.exps.Arguments newArgumentList(org.apache.openjpa.kernel.exps.Value arg1,
                                                                org.apache.openjpa.kernel.exps.Value arg2)
Return a function argument list consisting of the given values, either of which may itself be an argument list.

Specified by:
newArgumentList in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newArgumentList

public org.apache.openjpa.kernel.exps.Arguments newArgumentList(org.apache.openjpa.kernel.exps.Value... values)
Return a function argument list consisting of the given values, any of which may itself be an argument list.

Specified by:
newArgumentList in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newUnboundVariable

public org.apache.openjpa.kernel.exps.Value newUnboundVariable(String name,
                                                               Class type)
Return an unbound variable. This method will only be called once for a given named unbound variable. The type may be Object if the variable is not declared.

Specified by:
newUnboundVariable in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newBoundVariable

public org.apache.openjpa.kernel.exps.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. The type may be Object if the variable is not declared.

Specified by:
newBoundVariable in interface org.apache.openjpa.kernel.exps.ExpressionFactory

cast

public org.apache.openjpa.kernel.exps.Value cast(org.apache.openjpa.kernel.exps.Value obj,
                                                 Class cls)
Cast the value to the given class.

Specified by:
cast in interface org.apache.openjpa.kernel.exps.ExpressionFactory

add

public org.apache.openjpa.kernel.exps.Value add(org.apache.openjpa.kernel.exps.Value num1,
                                                org.apache.openjpa.kernel.exps.Value num2)
Return a value representing the two values added together.

Specified by:
add in interface org.apache.openjpa.kernel.exps.ExpressionFactory

subtract

public org.apache.openjpa.kernel.exps.Value subtract(org.apache.openjpa.kernel.exps.Value num1,
                                                     org.apache.openjpa.kernel.exps.Value num2)
Return a value representing the second value subtracted from the first.

Specified by:
subtract in interface org.apache.openjpa.kernel.exps.ExpressionFactory

multiply

public org.apache.openjpa.kernel.exps.Value multiply(org.apache.openjpa.kernel.exps.Value num1,
                                                     org.apache.openjpa.kernel.exps.Value num2)
Return a value representing the two values multiplied together.

Specified by:
multiply in interface org.apache.openjpa.kernel.exps.ExpressionFactory

divide

public org.apache.openjpa.kernel.exps.Value divide(org.apache.openjpa.kernel.exps.Value num1,
                                                   org.apache.openjpa.kernel.exps.Value num2)
Return a value representing the first value divided by the first one.

Specified by:
divide in interface org.apache.openjpa.kernel.exps.ExpressionFactory

mod

public org.apache.openjpa.kernel.exps.Value mod(org.apache.openjpa.kernel.exps.Value num1,
                                                org.apache.openjpa.kernel.exps.Value num2)
Return a value representing the first value mod'd by the second one.

Specified by:
mod in interface org.apache.openjpa.kernel.exps.ExpressionFactory

abs

public org.apache.openjpa.kernel.exps.Value abs(org.apache.openjpa.kernel.exps.Value num)
Return a value representing the absolute value of the given one.

Specified by:
abs in interface org.apache.openjpa.kernel.exps.ExpressionFactory

indexOf

public org.apache.openjpa.kernel.exps.Value indexOf(org.apache.openjpa.kernel.exps.Value str,
                                                    org.apache.openjpa.kernel.exps.Value args)
Return a value representing the String.indexOf(int) function on the given target with the given args.

Specified by:
indexOf in interface org.apache.openjpa.kernel.exps.ExpressionFactory

concat

public org.apache.openjpa.kernel.exps.Value concat(org.apache.openjpa.kernel.exps.Value str,
                                                   org.apache.openjpa.kernel.exps.Value args)
Return a value representing the concatenation of the given target with the given args.

Specified by:
concat in interface org.apache.openjpa.kernel.exps.ExpressionFactory

sqrt

public org.apache.openjpa.kernel.exps.Value sqrt(org.apache.openjpa.kernel.exps.Value num)
Return the square root of the given value.

Specified by:
sqrt in interface org.apache.openjpa.kernel.exps.ExpressionFactory

substring

public org.apache.openjpa.kernel.exps.Value substring(org.apache.openjpa.kernel.exps.Value str,
                                                      org.apache.openjpa.kernel.exps.Value args)
Return a value representing the String.substring(int) function on the given target with the given args. As with String.substring(int), the start index is zero-based, and the second argument is the end index.

Specified by:
substring in interface org.apache.openjpa.kernel.exps.ExpressionFactory

toUpperCase

public org.apache.openjpa.kernel.exps.Value toUpperCase(org.apache.openjpa.kernel.exps.Value str)
Return the upper case of the given value.

Specified by:
toUpperCase in interface org.apache.openjpa.kernel.exps.ExpressionFactory

toLowerCase

public org.apache.openjpa.kernel.exps.Value toLowerCase(org.apache.openjpa.kernel.exps.Value str)
Return the upper case of the given value.

Specified by:
toLowerCase in interface org.apache.openjpa.kernel.exps.ExpressionFactory

avg

public org.apache.openjpa.kernel.exps.Value avg(org.apache.openjpa.kernel.exps.Value num)
Return the average of the given value for all matches.

Specified by:
avg in interface org.apache.openjpa.kernel.exps.ExpressionFactory

count

public org.apache.openjpa.kernel.exps.Value count(org.apache.openjpa.kernel.exps.Value obj)
Return the count of the given value for all matches.

Specified by:
count in interface org.apache.openjpa.kernel.exps.ExpressionFactory

max

public org.apache.openjpa.kernel.exps.Value max(org.apache.openjpa.kernel.exps.Value num)
Return the max of the given value for all matches.

Specified by:
max in interface org.apache.openjpa.kernel.exps.ExpressionFactory

min

public org.apache.openjpa.kernel.exps.Value min(org.apache.openjpa.kernel.exps.Value num)
Return the max of the given value for all matches.

Specified by:
min in interface org.apache.openjpa.kernel.exps.ExpressionFactory

sum

public org.apache.openjpa.kernel.exps.Value sum(org.apache.openjpa.kernel.exps.Value num)
Return the max of the given value for all matches.

Specified by:
sum in interface org.apache.openjpa.kernel.exps.ExpressionFactory

any

public org.apache.openjpa.kernel.exps.Value any(org.apache.openjpa.kernel.exps.Value target)
Return an expression representing the given condition.

Specified by:
any in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Since:
0.4.0.0

all

public org.apache.openjpa.kernel.exps.Value all(org.apache.openjpa.kernel.exps.Value target)
Return an expression representing the given condition.

Specified by:
all in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Since:
0.4.0.0

size

public org.apache.openjpa.kernel.exps.Value size(org.apache.openjpa.kernel.exps.Value target)
Return an expression representing the given condition.

Specified by:
size in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Since:
0.4.0.0

index

public org.apache.openjpa.kernel.exps.Value index(org.apache.openjpa.kernel.exps.Value target)
Return an index/position of the given value within a collection/map.

Specified by:
index in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Since:
2.0.0

type

public org.apache.openjpa.kernel.exps.Value type(org.apache.openjpa.kernel.exps.Value target)
Return the type/class of the given value.

Specified by:
type in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Since:
2.0.0

mapEntry

public org.apache.openjpa.kernel.exps.Value mapEntry(org.apache.openjpa.kernel.exps.Value key,
                                                     org.apache.openjpa.kernel.exps.Value val)
Return the map entry of the given value.

Specified by:
mapEntry in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Since:
2.0.0

mapKey

public org.apache.openjpa.kernel.exps.Value mapKey(org.apache.openjpa.kernel.exps.Value key,
                                                   org.apache.openjpa.kernel.exps.Value val)
Return the map key of the given value

Specified by:
mapKey in interface org.apache.openjpa.kernel.exps.ExpressionFactory

getKey

public org.apache.openjpa.kernel.exps.Value getKey(org.apache.openjpa.kernel.exps.Value val)
Path navigation thru map key

Specified by:
getKey in interface org.apache.openjpa.kernel.exps.ExpressionFactory

distinct

public org.apache.openjpa.kernel.exps.Value distinct(org.apache.openjpa.kernel.exps.Value obj)
Return distinct values of the given value. This is typically used within aggregates, for example: max(distinct(path))

Specified by:
distinct in interface org.apache.openjpa.kernel.exps.ExpressionFactory
Since:
0.4.0.0

getObjectId

public org.apache.openjpa.kernel.exps.Value getObjectId(org.apache.openjpa.kernel.exps.Value val)
Return the object id of the given value.

Specified by:
getObjectId in interface org.apache.openjpa.kernel.exps.ExpressionFactory

simpleCaseExpression

public org.apache.openjpa.kernel.exps.Value simpleCaseExpression(org.apache.openjpa.kernel.exps.Value caseOperand,
                                                                 org.apache.openjpa.kernel.exps.Expression[] exp,
                                                                 org.apache.openjpa.kernel.exps.Value val)
Return a simple case expression

Specified by:
simpleCaseExpression in interface org.apache.openjpa.kernel.exps.ExpressionFactory

generalCaseExpression

public org.apache.openjpa.kernel.exps.Value generalCaseExpression(org.apache.openjpa.kernel.exps.Expression[] exp,
                                                                  org.apache.openjpa.kernel.exps.Value val)
Return a general case expression

Specified by:
generalCaseExpression in interface org.apache.openjpa.kernel.exps.ExpressionFactory

whenCondition

public org.apache.openjpa.kernel.exps.Expression whenCondition(org.apache.openjpa.kernel.exps.Expression exp,
                                                               org.apache.openjpa.kernel.exps.Value val)
Return a when condidional clause

Specified by:
whenCondition in interface org.apache.openjpa.kernel.exps.ExpressionFactory

whenScalar

public org.apache.openjpa.kernel.exps.Expression whenScalar(org.apache.openjpa.kernel.exps.Value val1,
                                                            org.apache.openjpa.kernel.exps.Value val2)
Return a when scalar_expression clause

Specified by:
whenScalar in interface org.apache.openjpa.kernel.exps.ExpressionFactory

coalesceExpression

public org.apache.openjpa.kernel.exps.Value coalesceExpression(org.apache.openjpa.kernel.exps.Value[] val)
Return a coalesce expression

Specified by:
coalesceExpression in interface org.apache.openjpa.kernel.exps.ExpressionFactory

nullIfExpression

public org.apache.openjpa.kernel.exps.Value nullIfExpression(org.apache.openjpa.kernel.exps.Value val1,
                                                             org.apache.openjpa.kernel.exps.Value val2)
Return a nullif expression

Specified by:
nullIfExpression in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newTypeLiteral

public org.apache.openjpa.kernel.exps.Literal newTypeLiteral(Object val,
                                                             int parseType)
Return a value representing the given constant, which will be a Number, String, or Boolean instance.

Specified by:
newTypeLiteral in interface org.apache.openjpa.kernel.exps.ExpressionFactory

newFunction

public org.apache.openjpa.kernel.exps.Value newFunction(String functionName,
                                                        Class<?> resultType,
                                                        org.apache.openjpa.kernel.exps.Value... args)
Return a value representing the given datastore function with the given arguments.

Specified by:
newFunction in interface org.apache.openjpa.kernel.exps.ExpressionFactory

isVerticalType

public boolean isVerticalType(org.apache.openjpa.kernel.exps.Value val)
Return true if the Value is a Type expression and the Type uses joined table strategy.


GigaSpaces XAP 9.1 API

Copyright © GigaSpaces.