public interface Function
Modifier and Type | Field and Description |
---|---|
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
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
evaluate(int functionType,
ExpressionQueryRequest request,
EvaluableExpression[] operand,
int expectedValueType)
Static evaluation of the function.
The functionType is one of ( 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() .The expectedValueType is one of ( 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.Implementations must respect the expected value type and must throw a EvaluationException when it
cannot generate a value of this type. |
void |
generateFilterPart(int functionType,
ExpressionQueryRequest request,
FilterPart filterPart,
EvaluableExpression[] operand,
int expectedValueType)
Generate the filter part for the function.
The functionType is one of ( 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() .The expectedValueType is one of ( 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.Implementations must respect the expected value type and must throw a FilterGeneratorException
when it cannot generate a value of this type. |
int |
getExpectedValueType(int functionType)
Get the value type which this expression is expected to return
|
int |
getMaxParameters()
Get maximum number of parameters.
|
int |
getMinParameters()
Get minimum number of parameters.
|
java.lang.String |
getName()
Get the name of the function.
|
java.lang.Class[] |
getSupportedDatasourceClasses()
Get the array of supported datasource classes for this function.
|
int[] |
getTypes()
Get the types of the function.
|
boolean |
supportStaticEvaluation()
Check whether the function supports static evaluation (calls to
evaluate(int, ExpressionQueryRequest, EvaluableExpression[], int)
without a given datasource). |
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
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 resultExpressionParserException
- 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 typeExpressionEvaluator.OBJECTTYPE_ANY
if no specific value type can be expected)ExpressionParserException
- in case of errorsCopyright © 2019 Gentics Software. All Rights Reserved.