Class HigherOrderBagFunction<RETURN_T extends Value,SUB_RETURN_T extends AttributeValue>
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.func.BaseFunction<RETURN_T>
-
- org.ow2.authzforce.core.pdp.api.func.HigherOrderBagFunction<RETURN_T,SUB_RETURN_T>
-
- Type Parameters:
RETURN_T
- return typeSUB_RETURN_T
- sub-function's return (primitive) type. Only functions returning primitive type of result are compatible with higher-order functions here.
- All Implemented Interfaces:
Function<RETURN_T>
,PdpExtension
,PrimitiveValue
,Value
public abstract class HigherOrderBagFunction<RETURN_T extends Value,SUB_RETURN_T extends AttributeValue> extends BaseFunction<RETURN_T>
Higher-order bag function- Version:
- $Id: $
-
-
Field Summary
-
Fields inherited from interface org.ow2.authzforce.core.pdp.api.func.Function
AUTHZFORCE_EXTENSION_PREFIX, XACML_NS_1_0, XACML_NS_2_0, XACML_NS_3_0
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HigherOrderBagFunction(String functionId, Datatype<RETURN_T> returnType, Datatype<?> subFunctionReturnType)
Instantiates higher-order bag function
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
checkNumberOfArgs(int numInputs)
checkNumberOfArgsprotected abstract FunctionCall<RETURN_T>
createFunctionCallFromSubFunction(FirstOrderFunction<SUB_RETURN_T> subFunc, List<Expression<?>> inputsAfterSubFunc)
Creates function call from sub-function definition and all inputs to higher-order function.Datatype<RETURN_T>
getReturnType()
Gets the return type of the functionFunctionCall<RETURN_T>
newCall(List<Expression<?>> inputs)
Creates new function call with given arguments (Expressions).-
Methods inherited from class org.ow2.authzforce.core.pdp.api.func.BaseFunction
equals, getId, getIndeterminateArgException, getIndeterminateArgMessage, hashCode, toString
-
-
-
-
Constructor Detail
-
HigherOrderBagFunction
protected HigherOrderBagFunction(String functionId, Datatype<RETURN_T> returnType, Datatype<?> subFunctionReturnType)
Instantiates higher-order bag function- Parameters:
functionId
- function IDreturnType
- function's return typesubFunctionReturnType
- sub-function's return datatype; may be null to indicate any datatype (e.g. map function's sub-function return datatype can be any primitive type)
-
-
Method Detail
-
getReturnType
public Datatype<RETURN_T> getReturnType()
Gets the return type of the function Returns the type of attribute value that will be returned by this function.- Returns:
- function return type
-
createFunctionCallFromSubFunction
protected abstract FunctionCall<RETURN_T> createFunctionCallFromSubFunction(FirstOrderFunction<SUB_RETURN_T> subFunc, List<Expression<?>> inputsAfterSubFunc)
Creates function call from sub-function definition and all inputs to higher-order function. To be overridden by OneBagOnlyFunctions (any-of/all-of)- Parameters:
subFunc
- first-order sub-functioninputsAfterSubFunc
- sub-function arguments- Returns:
- function call
-
newCall
public final FunctionCall<RETURN_T> newCall(List<Expression<?>> inputs) throws IllegalArgumentException
Creates new function call with given arguments (Expressions). Any implementation of this method should first validate inputs according to the function signature/definition.- Parameters:
inputs
- function arguments (expressions)- Returns:
- Function call handle for calling this function which such inputs (with possible changes from original inputs due to optimizations for instance)
- Throws:
IllegalArgumentException
- if inputs are invalid for this function
-
checkNumberOfArgs
protected abstract void checkNumberOfArgs(int numInputs)
checkNumberOfArgs
- Parameters:
numInputs
- a int.
-
-