org.datanucleus.store.mapped.expression
Interface ExpressionMethodAdapter

All Known Subinterfaces:
DatastoreAdapter

public interface ExpressionMethodAdapter

Interface that allows one datastore adapt operations.


Method Summary
 BooleanExpression endsWithMethod(ScalarExpression leftOperand, ScalarExpression rightOperand)
          Returns whether this string ends with the specified string.
 ScalarExpression getCurrentDateMethod(QueryExpression qs)
          Method to return an expression for the current date in the datastore.
 ScalarExpression getCurrentTimeMethod(QueryExpression qs)
          Method to return an expression for the current time in the datastore.
 ScalarExpression getCurrentTimestampMethod(QueryExpression qs)
          Method to return an expression for the current timestamp in the datastore.
 NumericExpression indexOfMethod(ScalarExpression source, ScalarExpression str, NumericExpression from)
          Method to handle the indexOf operation.
 StringExpression lowerMethod(StringExpression str)
          Returns the expression for the JDOQL String.toLowerCase(str) method.
 BooleanExpression matchesMethod(StringExpression text, StringExpression pattern)
          Matches this to the argument expression pattern.
 BooleanExpression startsWithMethod(ScalarExpression source, ScalarExpression str)
          Method to handle the starts with operation.
 StringExpression substringMethod(StringExpression str, NumericExpression begin)
          Returns the expression for the JDOQL String.substring(str,begin) method.
 StringExpression substringMethod(StringExpression str, NumericExpression begin, NumericExpression end)
          Returns the expression for the JDOQL String.substring(str,begin,end) method.
 StringExpression translateMethod(ScalarExpression expr, ScalarExpression toExpr, ScalarExpression fromExpr)
          Method to translate all chars in this expression to the fromExpr which corresponds to toExpr.
 StringExpression trimMethod(StringExpression str, boolean leading, boolean trailing)
          Returns the expression for the JDOQL String.trim(str) method.
 StringExpression upperMethod(StringExpression str)
          Returns the expression for the JDOQL String.toUpperCase(str) method.
 

Method Detail

endsWithMethod

BooleanExpression endsWithMethod(ScalarExpression leftOperand,
                                 ScalarExpression rightOperand)
Returns whether this string ends with the specified string.

Parameters:
leftOperand - the source string
rightOperand - The string to compare against.
Returns:
Whether it ends with the string.

substringMethod

StringExpression substringMethod(StringExpression str,
                                 NumericExpression begin)
Returns the expression for the JDOQL String.substring(str,begin) method. In SQL, it may compile to:

 SUBSTRING(str FROM begin)
 
Note that the value of begin is base 0(Java-style), while most SQL string functions use base 1.

Parameters:
str - The first argument to the substring() method.
begin - The second argument to the substring() method.
Returns:
The expression.

substringMethod

StringExpression substringMethod(StringExpression str,
                                 NumericExpression begin,
                                 NumericExpression end)
Returns the expression for the JDOQL String.substring(str,begin,end) method. In SQL, it may compile to:

 SUBSTRING(str FROM begin FOR len)
 
Note that the value of begin is base 0 (Java-style), while most SQL string functions use base 1. Note also that an end position is given, while most SQL substring functions take a length.

Parameters:
str - The first argument to the substring() method.
begin - The second argument to the substring() method.
end - The third argument to the substring() method.
Returns:
The expression.

startsWithMethod

BooleanExpression startsWithMethod(ScalarExpression source,
                                   ScalarExpression str)
Method to handle the starts with operation.

Parameters:
source - The expression with the searched string
str - The expression for the search string
Returns:
The expression.

indexOfMethod

NumericExpression indexOfMethod(ScalarExpression source,
                                ScalarExpression str,
                                NumericExpression from)
Method to handle the indexOf operation.

Parameters:
source - The expression with the searched string
str - The expression for the search string
from - Position to start searching from
Returns:
The expression.

trimMethod

StringExpression trimMethod(StringExpression str,
                            boolean leading,
                            boolean trailing)
Returns the expression for the JDOQL String.trim(str) method. In SQL, it may compile to:
TRIM(str)

Parameters:
str - The first argument to the trim() method.
leading - Whether to trim leading spaces
trailing - Whether to trim trailing spaces
Returns:
The expression.

matchesMethod

BooleanExpression matchesMethod(StringExpression text,
                                StringExpression pattern)
Matches this to the argument expression pattern. Use "." to find any character and ".*" for wildcard matches. A global case-insensitive flag "(?i)" can be set for the pattern. If used, the global case-insensitive flag must prefix the pattern. The pattern passed to matches must be a literal or parameter.

Parameters:
text - The argument to the length() method.
pattern - The literal expression with the pattern.
Returns:
the match expression.

translateMethod

StringExpression translateMethod(ScalarExpression expr,
                                 ScalarExpression toExpr,
                                 ScalarExpression fromExpr)
Method to translate all chars in this expression to the fromExpr which corresponds to toExpr.

Returns:
The expression.

lowerMethod

StringExpression lowerMethod(StringExpression str)
Returns the expression for the JDOQL String.toLowerCase(str) method. In SQL, it may compile to:
LOWER(str)

Parameters:
str - The first argument to the trim() method.
Returns:
The expression.

upperMethod

StringExpression upperMethod(StringExpression str)
Returns the expression for the JDOQL String.toUpperCase(str) method. In SQL, it may compile to:
UPPER(str)

Parameters:
str - The first argument to the trim() method.
Returns:
The expression.

getCurrentDateMethod

ScalarExpression getCurrentDateMethod(QueryExpression qs)
Method to return an expression for the current date in the datastore.

Parameters:
qs - QueryExpression
Returns:
Current date expression for this datastore

getCurrentTimeMethod

ScalarExpression getCurrentTimeMethod(QueryExpression qs)
Method to return an expression for the current time in the datastore.

Parameters:
qs - QueryExpression
Returns:
Current time expression for this datastore

getCurrentTimestampMethod

ScalarExpression getCurrentTimestampMethod(QueryExpression qs)
Method to return an expression for the current timestamp in the datastore.

Parameters:
qs - QueryExpression
Returns:
Current timestamp expression for this datastore


Copyright © 2010. All Rights Reserved.