|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Function
Interface for functions. All parts of a parsed expression are implemented as
"functions" ("and", "or", "==", ...), not only the named expression
functions. A "named" function is something like "concat(...), isempty(...),
..." in the expression.
Any implementation of this interface must be
stateless and threadsafe.
Field Summary | |
---|---|
static java.lang.String[] |
FUNCTIONTYPE_NAMES
constant of the function type names |
static int[] |
NAMEDFUNCTION
type constant for a namedfunction. |
static int |
TYPE_ADD
constant for binary "+" operations |
static int |
TYPE_AND
constant for boolean "and" operation |
static int |
TYPE_CONTAINSALL
constant for "containsall" comparisons |
static int |
TYPE_CONTAINSNONE
constant for "containsnone" comparisons |
static int |
TYPE_CONTAINSONEOF
constant for "containsoneof" comparisons |
static int |
TYPE_DIV
constant for binary "/" operations |
static int |
TYPE_EQUAL
constant for "equals" comparisons |
static int |
TYPE_GREATER
constant for "greater" comparisons |
static int |
TYPE_GREATEROREQUAL
constant for "greater or equal" comparisons |
static int |
TYPE_LIKE
constant for "like" comparisons |
static int |
TYPE_MINUS
constant for unary "-" operations |
static int |
TYPE_MOD
constant for binary "%" operations |
static int |
TYPE_MULT
constant for binary "*" operations |
static int |
TYPE_NAMEDFUNCTION
constant for "named functions" |
static int |
TYPE_NOT
constant for unary "!" operations |
static int |
TYPE_OR
constant for boolean "and" operation |
static int |
TYPE_PLUS
constant for unary "+" operations |
static int |
TYPE_SMALLER
constant for "smaller" comparisons |
static int |
TYPE_SMALLEROREQUAL
constant for "smaller or equal" comparisons |
static int |
TYPE_SUB
constant for binary "-" operations |
static int |
TYPE_UNEQUAL
constant for "unequal" comparisons |
static int |
TYPE_UNKNOWN
constant for unknown function type (this must always be the highest index) |
static int |
UNBOUNDED
constant for unbounded number of operands |
Field Detail |
---|
static final int[] NAMEDFUNCTION
static final int UNBOUNDED
static final int TYPE_NAMEDFUNCTION
static final int TYPE_AND
static final int TYPE_OR
static final int TYPE_EQUAL
static final int TYPE_SMALLER
static final int TYPE_SMALLEROREQUAL
static final int TYPE_GREATEROREQUAL
static final int TYPE_GREATER
static final int TYPE_UNEQUAL
static final int TYPE_CONTAINSONEOF
static final int TYPE_CONTAINSNONE
static final int TYPE_LIKE
static final int TYPE_ADD
static final int TYPE_SUB
static final int TYPE_MULT
static final int TYPE_DIV
static final int TYPE_MOD
static final int TYPE_MINUS
static final int TYPE_PLUS
static final int TYPE_NOT
static final int TYPE_CONTAINSALL
static final int TYPE_UNKNOWN
static final java.lang.String[] FUNCTIONTYPE_NAMES
Method Detail |
---|
java.lang.Object evaluate(int functionType, ExpressionQueryRequest request, EvaluableExpression[] operand, int expectedValueType) throws ExpressionParserException
TYPE_ADD
,
TYPE_AND
, TYPE_CONTAINSNONE
,
TYPE_CONTAINSNONE
, TYPE_DIV
, TYPE_EQUAL
,
TYPE_GREATER
, TYPE_GREATEROREQUAL
, TYPE_LIKE
,
TYPE_MINUS
, TYPE_MOD
, TYPE_MULT
,
TYPE_NAMEDFUNCTION
, TYPE_NOT
, TYPE_OR
,
TYPE_PLUS
, TYPE_SMALLER
, TYPE_SMALLEROREQUAL
,
TYPE_SUB
, TYPE_UNEQUAL
) and will always be one of the
types returned by getTypes()
.ExpressionEvaluator.OBJECTTYPE_ANY
,
ExpressionEvaluator.OBJECTTYPE_BOOLEAN
,
ExpressionEvaluator.OBJECTTYPE_COLLECTION
,
ExpressionEvaluator.OBJECTTYPE_DATE
,
ExpressionEvaluator.OBJECTTYPE_NULL
,
ExpressionEvaluator.OBJECTTYPE_NUMBER
,
ExpressionEvaluator.OBJECTTYPE_STRING
), where
ExpressionEvaluator.OBJECTTYPE_ANY
shall be used when any value
type is acceptable.EvaluationException
when it
cannot generate a value of this type.
functionType
- type of the functionrequest
- expression requestoperand
- array of function operandsexpectedValueType
- expected value type for the result.
ExpressionParserException
- when evaluation of the function failsExpressionEvaluator
void generateFilterPart(int functionType, ExpressionQueryRequest request, FilterPart filterPart, EvaluableExpression[] operand, int expectedValueType) throws ExpressionParserException
TYPE_ADD
, TYPE_AND
, TYPE_CONTAINSNONE
,
TYPE_CONTAINSNONE
, TYPE_DIV
, TYPE_EQUAL
,
TYPE_GREATER
, TYPE_GREATEROREQUAL
, TYPE_LIKE
,
TYPE_MINUS
, TYPE_MOD
, TYPE_MULT
,
TYPE_NAMEDFUNCTION
, TYPE_NOT
, TYPE_OR
,
TYPE_PLUS
, TYPE_SMALLER
, TYPE_SMALLEROREQUAL
,
TYPE_SUB
, TYPE_UNEQUAL
) and will always be one of the
types returned by getTypes()
.ExpressionEvaluator.OBJECTTYPE_ANY
,
ExpressionEvaluator.OBJECTTYPE_BOOLEAN
,
ExpressionEvaluator.OBJECTTYPE_COLLECTION
,
ExpressionEvaluator.OBJECTTYPE_DATE
,
ExpressionEvaluator.OBJECTTYPE_NULL
,
ExpressionEvaluator.OBJECTTYPE_NUMBER
,
ExpressionEvaluator.OBJECTTYPE_STRING
), where
ExpressionEvaluator.OBJECTTYPE_ANY
shall be used when any value
type is acceptable.FilterGeneratorException
when it cannot generate a value of this type.
functionType
- type of the functionrequest
- expression requestfilterPart
- filterpart that is generatedoperand
- array of function operandsexpectedValueType
- expected value type for the result
ExpressionParserException
- when generation of the filter part
failsExpressionEvaluator
java.lang.String getName()
TYPE_NAMEDFUNCTION
.
getTypes()
,
TYPE_NAMEDFUNCTION
int[] getTypes()
TYPE_ADD
,
TYPE_AND
, TYPE_CONTAINSNONE
,
TYPE_CONTAINSNONE
, TYPE_DIV
, TYPE_EQUAL
,
TYPE_GREATER
, TYPE_GREATEROREQUAL
, TYPE_LIKE
,
TYPE_MINUS
, TYPE_MOD
, TYPE_MULT
,
TYPE_NAMEDFUNCTION
, TYPE_NOT
, TYPE_OR
,
TYPE_PLUS
, TYPE_SMALLER
, TYPE_SMALLEROREQUAL
,
TYPE_SUB
, TYPE_UNEQUAL
). The function is registered
to implement the returned function types and will be called for only
those types.
int getMinParameters()
int getMaxParameters()
UNBOUNDED
(for
unlimited number of parameters) or <= getMinParameters()
.
getMinParameters()
java.lang.Class[] getSupportedDatasourceClasses()
ExpressionEvaluator
for functions that
implement the evaluation of expression parts.
ExpressionEvaluator
boolean supportStaticEvaluation()
evaluate(int, ExpressionQueryRequest, EvaluableExpression[], int)
without a given datasource).
int getExpectedValueType(int functionType) throws ExpressionParserException
functionType
- function type
ExpressionEvaluator.OBJECTTYPE_ANY
if no specific value type can be expected)
ExpressionParserException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |