Package org.apache.cayenne.exp
Class FunctionExpressionFactory
java.lang.Object
org.apache.cayenne.exp.FunctionExpressionFactory
Collection of factory methods to create function call expressions.
- Since:
- 4.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic Expressionstatic ExpressionabsExp(Expression exp) static ExpressionavgExp(Expression exp) static ExpressionFactory method for expression to call CONCAT(string1, string2, ...) functionstatic ExpressionconcatExp(Expression... expressions) Factory method for expression to call CONCAT(string1, string2, ...) functionstatic Expressionstatic ExpressioncountExp()static ExpressioncountExp(Expression exp) static Expressionstatic Expressionstatic Expressionstatic ExpressioncustomAggregateExp(String function, Expression exp) static ExpressiondayOfMonthExp(String path) static ExpressiondayOfMonthExp(Expression exp) static ExpressiondayOfWeekExp(String path) static ExpressiondayOfWeekExp(Expression exp) static ExpressiondayOfYearExp(String path) static ExpressiondayOfYearExp(Expression exp) static ExpressionfunctionCall(String function, Object... args) static Expressionstatic ExpressionhourExp(Expression exp) static Expressionstatic ExpressionlengthExp(Expression exp) static ExpressionCall LOCATE(substring, string) function that return position of substring in string or 0 if it is not found.static ExpressionlocateExp(String substring, Expression exp) Call LOCATE(substring, string) function that return position of substring in string or 0 if it is not found.static ExpressionlocateExp(Expression substring, Expression exp) Call LOCATE(substring, string) function that return position of substring in string or 0 if it is not found.static Expressionstatic ExpressionlowerExp(Expression exp) static ExpressionmaxExp(Expression exp) static ExpressionminExp(Expression exp) static Expressionstatic ExpressionminuteExp(Expression exp) static Expressionstatic ExpressionmodExp(Expression exp, Number number) static ExpressionmodExp(Expression exp, Expression number) static Expressionstatic ExpressionmonthExp(Expression exp) static Expressionstatic Expressionstatic ExpressionsecondExp(Expression exp) static Expressionstatic ExpressionsqrtExp(Expression exp) static ExpressionsubstringExp(String path, int offset, int length) Call SUBSTRING(string, offset, length) functionstatic ExpressionsubstringExp(Expression exp, int offset, int length) Call SUBSTRING(string, offset, length) functionstatic ExpressionsubstringExp(Expression exp, Expression offset, Expression length) Call SUBSTRING(string, offset, length) functionstatic ExpressionsumExp(Expression exp) static Expressionstatic ExpressiontrimExp(Expression exp) static Expressionstatic ExpressionupperExp(Expression exp) static Expressionstatic ExpressionweekExp(Expression exp) static Expressionstatic ExpressionyearExp(Expression exp) 
- 
Constructor Details- 
FunctionExpressionFactorypublic FunctionExpressionFactory()
 
- 
- 
Method Details- 
substringExpCall SUBSTRING(string, offset, length) function- Parameters:
- exp- expression that must evaluate to string
- offset- start offset of substring
- length- length of substring
- Returns:
- SUBSTRING() call expression
 
- 
substringExpCall SUBSTRING(string, offset, length) function- Parameters:
- path- Object path value
- offset- start offset of substring
- length- length of substring
- Returns:
- SUBSTRING() call expression
 
- 
substringExpCall SUBSTRING(string, offset, length) function- Parameters:
- exp- expression that must evaluate to string
- offset- start offset of substring must evaluate to int
- length- length of substring must evaluate to int
- Returns:
- SUBSTRING() call expression
 
- 
trimExp- Parameters:
- exp- string expression to trim
- Returns:
- TRIM() call expression
 
- 
trimExp- Parameters:
- path- object path value
- Returns:
- TRIM() call expression
 
- 
lowerExp- Parameters:
- exp- string expression
- Returns:
- LOWER() call expression
 
- 
lowerExp- Parameters:
- path- object path value
- Returns:
- LOWER() call expression
 
- 
upperExp- Parameters:
- exp- string expression
- Returns:
- UPPER() call expression
 
- 
upperExp- Parameters:
- path- object path value
- Returns:
- UPPER() call expression
 
- 
lengthExp- Parameters:
- exp- string expression
- Returns:
- LENGTH() call expression
 
- 
lengthExp- Parameters:
- path- object path value
- Returns:
- LENGTH() call expression
 
- 
locateExpCall LOCATE(substring, string) function that return position of substring in string or 0 if it is not found.- Parameters:
- substring- object path value
- exp- string expression
- Returns:
- LOCATE() call expression
 
- 
locateExpCall LOCATE(substring, string) function that return position of substring in string or 0 if it is not found.- Parameters:
- substring- object path value
- path- object path
- Returns:
- LOCATE() call expression
 
- 
locateExpCall LOCATE(substring, string) function that return position of substring in string or 0 if it is not found.- Parameters:
- substring- string expression
- exp- string expression
- Returns:
- LOCATE() call expression
 
- 
absExp- Parameters:
- exp- numeric expression
- Returns:
- ABS() call expression
 
- 
absExp- Parameters:
- path- object path value
- Returns:
- ABS() call expression
 
- 
sqrtExp- Parameters:
- exp- numeric expression
- Returns:
- SQRT() call expression
 
- 
sqrtExp- Parameters:
- path- object path value
- Returns:
- SQRT() call expression
 
- 
modExp- Parameters:
- exp- numeric expression
- number- divisor
- Returns:
- MOD() call expression
 
- 
modExp- Parameters:
- path- object path value
- number- divisor
- Returns:
- MOD() call expression
 
- 
modExp- Parameters:
- exp- object path value
- number- numeric expression
- Returns:
- MOD() call expression
 
- 
concatExpFactory method for expression to call CONCAT(string1, string2, ...) function Can be used like: Expression concat = concatExp(SomeClass.POPERTY_1.getPath(), SomeClass.PROPERTY_2.getPath()); SQL generation note: - if DB supports CONCAT function with vararg then it will be used
- if DB supports CONCAT function with two args but also supports concat operator, then operator (eg ||) will be used
- if DB supports only CONCAT function with two args then it will be used what can lead to SQL exception if used with more than two arguments
 Currently only known DB with limited concatenation functionality is Openbase. - Parameters:
- expressions- array of expressions
- Returns:
- CONCAT() call expression
 
- 
concatExpFactory method for expression to call CONCAT(string1, string2, ...) function Can be used like: Expression concat = concatExp("property1", "property2");SQL generation note: - if DB supports CONCAT function with vararg then it will be used
- if DB supports CONCAT function with two args but also supports concat operator, then operator (eg ||) will be used
- if DB supports only CONCAT function with two args then it will be used what can lead to SQL exception if used with more than two arguments
 Currently only Openbase DB has limited concatenation functionality. - Parameters:
- paths- array of paths
- Returns:
- CONCAT() call expression
 
- 
countExp- Returns:
- Expression COUNT(*)
 
- 
countExp- Returns:
- Expression COUNT(exp)
 
- 
countDistinctExp- Returns:
- Expression COUNT(DISTINCT(exp))
- Since:
- 4.1
 
- 
minExp- Returns:
- Expression MIN(exp)
 
- 
maxExp- Returns:
- Expression MAX(exp)
 
- 
avgExp- Returns:
- Expression AVG(exp)
 
- 
sumExp- Returns:
- SUM(exp) expression
 
- 
customAggregateExp- Returns:
- *function*(exp) expression
- Since:
- 5.0
 
- 
currentDate- Returns:
- CURRENT_DATE expression
 
- 
currentTime- Returns:
- CURRENT_TIME expression
 
- 
currentTimestamp- Returns:
- CURRENT_TIMESTAMP expression
 
- 
yearExp- Parameters:
- exp- date/timestamp expression
- Returns:
- year(exp) function expression
 
- 
yearExp- Parameters:
- path- String path
- Returns:
- year(path) function expression
 
- 
monthExp- Parameters:
- exp- date/timestamp expression
- Returns:
- month(exp) function expression
 
- 
monthExp- Parameters:
- path- String path
- Returns:
- month(path) function expression
 
- 
weekExp- Parameters:
- exp- date/timestamp expression
- Returns:
- week(exp) function expression
 
- 
weekExp- Parameters:
- path- String path
- Returns:
- week(path) function expression
 
- 
dayOfYearExp- Parameters:
- exp- date/timestamp expression
- Returns:
- dayOfYear(exp) function expression
 
- 
dayOfYearExp- Parameters:
- path- String path
- Returns:
- dayOfYear(path) function expression
 
- 
dayOfMonthExp- Parameters:
- exp- date/timestamp expression
- Returns:
- dayOfMonth(exp) function expression, synonym for day()
 
- 
dayOfMonthExp- Parameters:
- path- String path
- Returns:
- dayOfMonth(path) function expression, synonym for day()
 
- 
dayOfWeekExp- Parameters:
- exp- date/timestamp expression
- Returns:
- dayOfWeek(exp) function expression
 
- 
dayOfWeekExp- Parameters:
- path- String path
- Returns:
- dayOfWeek(path) function expression
 
- 
hourExp- Parameters:
- exp- date/timestamp expression
- Returns:
- hour(exp) function expression
 
- 
hourExp- Parameters:
- path- String path
- Returns:
- hour(path) function expression
 
- 
minuteExp- Parameters:
- exp- date/timestamp expression
- Returns:
- minute(exp) function expression
 
- 
minuteExp- Parameters:
- path- String path
- Returns:
- minute(path) function expression
 
- 
secondExp- Parameters:
- exp- date/timestamp expression
- Returns:
- second(exp) function expression
 
- 
secondExp- Parameters:
- path- String path
- Returns:
- second(path) function expression
 
- 
functionCall- Parameters:
- function- name to call
- args- function arguments
- Returns:
- expression to call "function" with provided arguments
- Since:
- 4.2
 
- 
operator- Parameters:
- operator- to call
- args- arguments
- Returns:
- expression to use custom "operator" with provided arguments
- Since:
- 4.2
 
 
-