public class XACML3HigherOrderFunction extends Object implements Function
Modifier and Type | Field and Description |
---|---|
static String |
NAME_ALL_OF |
static String |
NAME_ANY_OF |
static String |
NAME_ANY_OF_ANY |
Constructor and Description |
---|
XACML3HigherOrderFunction(String functionName)
Creates a new instance of the given function.
|
Modifier and Type | Method and Description |
---|---|
void |
checkInputs(List inputs)
Checks that the given inputs are of the right types, in the right order, and are the right
number for this function to evaluate.
|
void |
checkInputsNoBag(List inputs)
Checks that the given inputs are of the right types, in the right order, and are the right
number for this function to evaluate.
|
String |
encode()
Encodes this
Function into its XML form |
void |
encode(StringBuilder builder)
Encodes this
Function into its XML form and writes this out to the provided
StringBuilder |
EvaluationResult |
evaluate(List inputs,
EvaluationCtx context)
Evaluates the
Function using the given inputs. |
URI |
getIdentifier()
Returns the identifier of this function as known by the factories.
|
URI |
getReturnType()
Provides the type of
AttributeValue that this function returns from
evaluate in a successful evaluation. |
static Set |
getSupportedIdentifiers()
Returns a
Set containing all the function identifiers supported by this class. |
URI |
getType()
Returns the type of the expression.
|
boolean |
returnsBag()
Tells whether this function will return a bag of values or just a single value.
|
public static final String NAME_ANY_OF
public static final String NAME_ALL_OF
public static final String NAME_ANY_OF_ANY
public XACML3HigherOrderFunction(String functionName)
functionName
- the function to createIllegalArgumentException
- if the function is unknownpublic static Set getSupportedIdentifiers()
Set
containing all the function identifiers supported by this class.Set
of String
spublic void checkInputs(List inputs) throws IllegalArgumentException
Function
IllegalArgumentException
is thrown.checkInputs
in interface Function
inputs
- a List
of Evaluatable
s, with the first argument being
a Function
if this is a higher-order functionIllegalArgumentException
- if the inputs do match what the function accepts for
evaluationpublic void checkInputsNoBag(List inputs) throws IllegalArgumentException
Function
IllegalArgumentException
is thrown. Unlike the other
checkInput
method in this interface, this assumes that the parameters will never
provide bags of values. This is useful if you're considering a target function which has a
designator or selector in its input list, but which passes the values from the derived bags
one at a time to the function, so the function doesn't have to deal with the bags that the
selector or designator generates.checkInputsNoBag
in interface Function
inputs
- a List
of Evaluatable
s, with the first argument being
a Function
if this is a higher-order functionIllegalArgumentException
- if the inputs do match what the function accepts for
evaluationpublic EvaluationResult evaluate(List inputs, EvaluationCtx context)
Function
Function
using the given inputs. The List
contains
Evaluatables which are all
of the correct type if the Function
has been created as part of an
Apply
or TargetMatch
, but which may otherwise be invalid. Each
parameter should be evaluated by the Function
, unless the Function
doesn't need to evaluate all inputs to determine a result (as in the case of the or
function). The order of the List
is significant, so a Function
should have a very good reason if it wants to evaluate the inputs in a different order.
Note that if this is a higher-order function, like any-of, then some argument (typically the
first) in the List
will actually be a Function object representing the function
to apply to some bag. A function needs to know if it's a higher-order function, and therefore
whether or not to look for this case. Also, a higher-order function is responsible for
checking that the inputs that it will pass to the Function
provided as the first
parameter are valid, ie. it must do a checkInputs
on its sub-function when
checkInputs
is called on the higher-order function.
public URI getIdentifier()
Function
getIdentifier
in interface Function
public URI getType()
Expression
AttributeValue
, the return type of a Function
, etc.getType
in interface Expression
public URI getReturnType()
Function
AttributeValue
that this function returns from
evaluate
in a successful evaluation.getReturnType
in interface Function
public boolean returnsBag()
Function
returnsBag
in interface Expression
returnsBag
in interface Function
public String encode()
Function
Function
into its XML formpublic void encode(StringBuilder builder)
Function
Function
into its XML form and writes this out to the provided
StringBuilder
encode
in interface Expression
encode
in interface Function
builder
- string stream into which the XML-encoded data is writtenCopyright © 2020 WSO2. All rights reserved.