org.jboss.security.xacml.sunxacml.cond
Class HigherOrderFunction

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.cond.HigherOrderFunction
All Implemented Interfaces:
Expression, Function

public class HigherOrderFunction
extends Object
implements Function

Represents all of the higher order bag functions, except map, which has its own class due to the issues with its return type. Unlike the other functions that are designed to work over any types (the type-* functions) these functions don't use specific names to describe what type they operate over, so you don't need to install new instances for any new datatypes you define.

Since:
1.0
Author:
Seth Proctor

Field Summary
static String NAME_ALL_OF
          Standard identifier for the all-of function.
static String NAME_ALL_OF_ALL
          Standard identifier for the all-of-all function.
static String NAME_ALL_OF_ANY
          Standard identifier for the all-of-any function.
static String NAME_ANY_OF
          Standard identifier for the any-of function.
static String NAME_ANY_OF_ALL
          Standard identifier for the any-of-all function.
static String NAME_ANY_OF_ANY
          Standard identifier for the any-of-any function.
 
Constructor Summary
HigherOrderFunction(String functionName)
          Creates a new instance of the given function.
 
Method Summary
 void checkInputs(List inputs)
          Checks that the given inputs are valid for this function.
 void checkInputsNoBag(List inputs)
          Checks that the given inputs are valid for this function if all inputs are considered to not be bags.
 void encode(OutputStream output)
          Encodes this HigherOrderFunction into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(OutputStream output, Indenter indenter)
          Encodes this HigherOrderFunction into its XML representation and writes this encoding to the given OutputStream with indentation.
 EvaluationResult evaluate(List inputs, EvaluationCtx context)
          Evaluates the function, using the specified parameters.
 URI getIdentifier()
          Returns the full identifier of this function, as known by the factories.
 URI getReturnType()
          Returns the type of attribute value that will be returned by this function.
static Set getSupportedIdentifiers()
          Returns a Set containing all the function identifiers supported by this class.
 URI getType()
          Returns the same value as getReturnType.
 boolean returnsBag()
          Returns whether or not this function will actually return a bag of values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_ANY_OF

public static final String NAME_ANY_OF
Standard identifier for the any-of function.

See Also:
Constant Field Values

NAME_ALL_OF

public static final String NAME_ALL_OF
Standard identifier for the all-of function.

See Also:
Constant Field Values

NAME_ANY_OF_ANY

public static final String NAME_ANY_OF_ANY
Standard identifier for the any-of-any function.

See Also:
Constant Field Values

NAME_ALL_OF_ANY

public static final String NAME_ALL_OF_ANY
Standard identifier for the all-of-any function.

See Also:
Constant Field Values

NAME_ANY_OF_ALL

public static final String NAME_ANY_OF_ALL
Standard identifier for the any-of-all function.

See Also:
Constant Field Values

NAME_ALL_OF_ALL

public static final String NAME_ALL_OF_ALL
Standard identifier for the all-of-all function.

See Also:
Constant Field Values
Constructor Detail

HigherOrderFunction

public HigherOrderFunction(String functionName)
Creates a new instance of the given function.

Parameters:
functionName - the function to create
Throws:
IllegalArgumentException - if the function is unknown
Method Detail

getSupportedIdentifiers

public static Set getSupportedIdentifiers()
Returns a Set containing all the function identifiers supported by this class.

Returns:
a Set of Strings

getIdentifier

public URI getIdentifier()
Returns the full identifier of this function, as known by the factories.

Specified by:
getIdentifier in interface Function
Returns:
the function's identifier

getType

public URI getType()
Returns the same value as getReturnType. This is here to support the Expression interface.

Specified by:
getType in interface Expression
Returns:
the return type

getReturnType

public URI getReturnType()
Returns the type of attribute value that will be returned by this function.

Specified by:
getReturnType in interface Function
Returns:
the return type

returnsBag

public boolean returnsBag()
Returns whether or not this function will actually return a bag of values.

Specified by:
returnsBag in interface Expression
Specified by:
returnsBag in interface Function
Returns:
true if the function returns a bag of values, otherwise false

evaluate

public EvaluationResult evaluate(List inputs,
                                 EvaluationCtx context)
Evaluates the function, using the specified parameters.

Specified by:
evaluate in interface Function
Parameters:
inputs - a List of Evaluatable objects representing the arguments passed to the function
context - an EvaluationCtx so that the Evaluatable objects can be evaluated
Returns:
an EvaluationResult representing the function's result

checkInputs

public void checkInputs(List inputs)
                 throws IllegalArgumentException
Checks that the given inputs are valid for this function.

Specified by:
checkInputs in interface Function
Parameters:
inputs - a List of Evaluatables
Throws:
IllegalArgumentException - if the inputs are invalid

checkInputsNoBag

public void checkInputsNoBag(List inputs)
                      throws IllegalArgumentException
Checks that the given inputs are valid for this function if all inputs are considered to not be bags. This always throws an exception, since this function by definition must work on bags.

Specified by:
checkInputsNoBag in interface Function
Parameters:
inputs - a List of Evaluatables
Throws:
IllegalArgumentException - always

encode

public void encode(OutputStream output)
Encodes this HigherOrderFunction into its XML representation and writes this encoding to the given OutputStream with no indentation.

Specified by:
encode in interface Expression
Specified by:
encode in interface Function
Parameters:
output - a stream into which the XML-encoded data is written

encode

public void encode(OutputStream output,
                   Indenter indenter)
Encodes this HigherOrderFunction into its XML representation and writes this encoding to the given OutputStream with indentation.

Specified by:
encode in interface Expression
Specified by:
encode in interface Function
Parameters:
output - a stream into which the XML-encoded data is written
indenter - an object that creates indentation strings


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.