RETURN
- function return typepublic abstract class BaseFirstOrderFunctionCall<RETURN extends Value> extends Object implements FirstOrderFunctionCall<RETURN>
FirstOrderFunctionCall
interface, to minimize the effort required to implement this interface. It requires a function definition and
given arguments to be passed to the function, and based on this information, enforces type checking. It is the recommended way of calling any FirstOrderFunction
instance.
Some of the arguments (expressions) may not be known in advance, but only at evaluation time (when calling evaluate(EvaluationContext, boolean, AttributeValue...)
). For example, when using
a FirstOrderFunction as a sub-function of the Higher-Order function 'any-of', the last arguments of the sub-function are determined during evaluation, after evaluating the expression of the last
input in the context, and getting the various values in the result bag.
In the case of such evaluation-time args, you must pass their types (the datatype of the last input bag in the previous example) as the remainingArgTypes
parameters to the
BaseFirstOrderFunctionCall
subclass (e.g. BaseFirstOrderFunctionCall.EagerEval
implementation) constructor, and correspond to the types of the remainingArgs
passed later as parameters to
evaluate(EvaluationContext, boolean, AttributeValue...)
.
Modifier and Type | Class and Description |
---|---|
static class |
BaseFirstOrderFunctionCall.EagerBagEval<RETURN_T extends Value,PARAM_BAG_ELEMENT_T extends AttributeValue>
Function call, for functions requiring eager (a.k.a.
|
static class |
BaseFirstOrderFunctionCall.EagerEval<RETURN_T extends Value>
Function call, for
FirstOrderFunction s requiring eager (aka greedy) evaluation of ALL their arguments' expressions to actual values, before the function can be evaluated. |
static class |
BaseFirstOrderFunctionCall.EagerMultiPrimitiveTypeEval<RETURN_T extends Value>
Function call, for functions requiring eager (a.k.a.
|
static class |
BaseFirstOrderFunctionCall.EagerPartlyBagEval<RETURN_T extends Value,PRIMITIVE_PARAM_T extends AttributeValue>
Function call, for functions requiring eager (a.k.a.
|
static class |
BaseFirstOrderFunctionCall.EagerSinglePrimitiveTypeEval<RETURN_T extends Value,PARAM_T extends AttributeValue>
Function call, for functions requiring eager (a.k.a.
|
Constructor and Description |
---|
BaseFirstOrderFunctionCall(FirstOrderFunctionSignature<RETURN> functionSig,
List<Expression<?>> argExpressions,
Datatype<?>... remainingArgTypes)
Instantiates a function call, including the validation of arguments (
inputExpressions ) according to the function definition. |
Modifier and Type | Method and Description |
---|---|
RETURN |
evaluate(EvaluationContext context)
Make the call in a given evaluation context
|
RETURN |
evaluate(EvaluationContext context,
boolean checkRemainingArgTypes,
AttributeValue... remainingArgs)
Make the call in a given evaluation context.
|
Datatype<RETURN> |
getReturnType()
Get the actual return type of this call (same as the internal function's return type), used as return type for XACML Apply in PDP.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evaluate
public BaseFirstOrderFunctionCall(FirstOrderFunctionSignature<RETURN> functionSig, List<Expression<?>> argExpressions, Datatype<?>... remainingArgTypes) throws IllegalArgumentException
inputExpressions
) according to the function definition.functionSig
- signature of function to which this call appliesargExpressions
- function arguments (expressions)remainingArgTypes
- types of arguments of which the actual Expressions are unknown at this point, but will be known and passed at evaluation time as remainingArgs
parameter to
evaluate(EvaluationContext, boolean, AttributeValue...)
, then FirstOrderFunctionCall.evaluate(EvaluationContext, AttributeValue...)
. Only non-bag/primitive values are valid
remainingArgs
to prevent varargs warning in FirstOrderFunctionCall.evaluate(EvaluationContext, AttributeValue...)
(potential heap pollution via varargs parameter) that would be caused
by using a parameterized type such as Value/Collection to represent both bags and primitives.IllegalArgumentException
- if inputs are invalid for this function or one of remainingArgTypes
is a bag type.public final RETURN evaluate(EvaluationContext context) throws IndeterminateEvaluationException
FunctionCall
evaluate
in interface FunctionCall<RETURN extends Value>
context
- evaluation contextIndeterminateEvaluationException
- if any evaluation errorpublic final RETURN evaluate(EvaluationContext context, boolean checkRemainingArgTypes, AttributeValue... remainingArgs) throws IndeterminateEvaluationException
FirstOrderFunctionCall
remainingArgTypes
if checkremainingArgTypes = true
evaluate
in interface FirstOrderFunctionCall<RETURN extends Value>
context
- evaluation contextcheckRemainingArgTypes
- whether to check types of remainingArgs
. It is strongly recommended to set this to true
always, unless you have already checked the types are OK before
calling this method and want to skip re-checking for efficiency.remainingArgs
- remaining args.IndeterminateEvaluationException
- if checkremainingArgTypes = true
and remainingArgs
do not check OK, or if they do but there was an error evaluating the function with such argumentspublic final Datatype<RETURN> getReturnType()
FunctionCall
getReturnType
in interface FunctionCall<RETURN extends Value>
Copyright © 2012–2020. All rights reserved.