Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.xacml.cond
Class FunctionBase  view FunctionBase download FunctionBase.java

java.lang.Object
  extended bycom.sun.xacml.cond.FunctionBase
All Implemented Interfaces:
Function
Direct Known Subclasses:
AbsFunction, AddFunction, BagFunction, ComparisonFunction, DateMathFunction, DivideFunction, EqualFunction, FloorFunction, LogicalFunction, MatchFunction, ModFunction, MultiplyFunction, NOfFunction, NotFunction, NumericConvertFunction, RoundFunction, SetFunction, StringNormalizeFunction, SubtractFunction

public abstract class FunctionBase
extends java.lang.Object
implements Function

An abstract utility superclass for functions. Supplies several useful methods, making it easier to implement a Function. You can extend this class or implement Function directly, depending on your needs.

Since:
1.0

Field Summary
static java.lang.String FUNCTION_NS
          The standard namespace where all the spec-defined functions live
private  int functionId
           
private  java.lang.String functionName
           
private  int minParams
           
private  int numParams
           
private  boolean paramIsBag
           
private  boolean[] paramsAreBags
           
private  java.lang.String paramType
           
private  java.lang.String[] paramTypes
           
private static java.util.List processingErrList
           
private  boolean returnsBag
           
private  java.lang.String returnType
           
private  boolean singleType
           
 
Constructor Summary
FunctionBase(java.lang.String functionName, int functionId, java.lang.String[] paramTypes, boolean[] paramIsBag, java.lang.String returnType, boolean returnsBag)
          Constructor that sets up the function as having different types for each given parameter.
FunctionBase(java.lang.String functionName, int functionId, java.lang.String returnType, boolean returnsBag)
          Constructor that sets up some basic values for functions that will take care of parameter checking on their own.
FunctionBase(java.lang.String functionName, int functionId, java.lang.String paramType, boolean paramIsBag, int numParams, int minParams, java.lang.String returnType, boolean returnsBag)
          Constructor that sets up the function as having some number of parameters all of the same given type.
FunctionBase(java.lang.String functionName, int functionId, java.lang.String paramType, boolean paramIsBag, int numParams, java.lang.String returnType, boolean returnsBag)
          Constructor that sets up the function as having some number of parameters all of the same given type.
 
Method Summary
 void checkInputs(java.util.List inputs)
          Default handling of input checking.
 void checkInputsNoBag(java.util.List inputs)
          Default handling of input checking.
protected  EvaluationResult evalArgs(java.util.List params, com.sun.xacml.EvaluationCtx context, com.sun.xacml.attr.AttributeValue[] args)
          Evaluates each of the parameters, in order, filling in the argument array with the resulting values.
 int getFunctionId()
          Returns the Identifier of the function to be handled by this particular object.
 java.lang.String getFunctionName()
          Returns the name of the function to be handled by this particular object.
 java.net.URI getIdentifier()
          Returns the full identifier of this function, as known by the factories.
 java.net.URI getReturnType()
          Get the attribute type returned by this function.
 java.lang.String getReturnTypeAsString()
          Returns the return type for this particular object.
protected static EvaluationResult makeProcessingError(java.lang.String message)
          Create an EvaluationResult that indicates a processing error with the specified message.
 boolean returnsBag()
          Returns true if this function returns a bag of values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xacml.cond.Function
evaluate
 

Field Detail

FUNCTION_NS

public static final java.lang.String FUNCTION_NS
The standard namespace where all the spec-defined functions live

See Also:
Constant Field Values

processingErrList

private static java.util.List processingErrList

functionName

private java.lang.String functionName

functionId

private int functionId

returnType

private java.lang.String returnType

returnsBag

private boolean returnsBag

singleType

private boolean singleType

paramType

private java.lang.String paramType

paramIsBag

private boolean paramIsBag

numParams

private int numParams

minParams

private int minParams

paramTypes

private java.lang.String[] paramTypes

paramsAreBags

private boolean[] paramsAreBags
Constructor Detail

FunctionBase

public FunctionBase(java.lang.String functionName,
                    int functionId,
                    java.lang.String paramType,
                    boolean paramIsBag,
                    int numParams,
                    java.lang.String returnType,
                    boolean returnsBag)
Constructor that sets up the function as having some number of parameters all of the same given type. If numParams is -1, then the length is variable


FunctionBase

public FunctionBase(java.lang.String functionName,
                    int functionId,
                    java.lang.String paramType,
                    boolean paramIsBag,
                    int numParams,
                    int minParams,
                    java.lang.String returnType,
                    boolean returnsBag)
Constructor that sets up the function as having some number of parameters all of the same given type. If numParams is -1, then the length is variable, and then minParams may be used to specify a minimum number of parameters. If numParams is not -1, then minParams is ignored.


FunctionBase

public FunctionBase(java.lang.String functionName,
                    int functionId,
                    java.lang.String[] paramTypes,
                    boolean[] paramIsBag,
                    java.lang.String returnType,
                    boolean returnsBag)
Constructor that sets up the function as having different types for each given parameter.


FunctionBase

public FunctionBase(java.lang.String functionName,
                    int functionId,
                    java.lang.String returnType,
                    boolean returnsBag)
Constructor that sets up some basic values for functions that will take care of parameter checking on their own. If you use this constructor for your function class, then you must override the two check methods to make sure that parameters are correct.

Method Detail

getIdentifier

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

Specified by:
getIdentifier in interface Function

getFunctionName

public java.lang.String getFunctionName()
Returns the name of the function to be handled by this particular object.


getFunctionId

public int getFunctionId()
Returns the Identifier of the function to be handled by this particular object.


getReturnType

public java.net.URI getReturnType()
Get the attribute type returned by this function.

Specified by:
getReturnType in interface Function

returnsBag

public boolean returnsBag()
Returns true if this function returns a bag of values.

Specified by:
returnsBag in interface Function

getReturnTypeAsString

public java.lang.String getReturnTypeAsString()
Returns the return type for this particular object.


makeProcessingError

protected static EvaluationResult makeProcessingError(java.lang.String message)
Create an EvaluationResult that indicates a processing error with the specified message. This method may be useful to subclasses.


evalArgs

protected EvaluationResult evalArgs(java.util.List params,
                                    com.sun.xacml.EvaluationCtx context,
                                    com.sun.xacml.attr.AttributeValue[] args)
Evaluates each of the parameters, in order, filling in the argument array with the resulting values. If any error occurs, this method returns the error, otherwise null is returned, signalling that evaluation was successful for all inputs, and the resulting argument list can be used.


checkInputs

public void checkInputs(java.util.List inputs)
                 throws java.lang.IllegalArgumentException
Default handling of input checking. This does some simple checking based on the type of constructor used. If you need anything more complex, or if you used the simple constructor, then you must override this method.

Specified by:
checkInputs in interface Function

checkInputsNoBag

public void checkInputsNoBag(java.util.List inputs)
                      throws java.lang.IllegalArgumentException
Default handling of input checking. This does some simple checking based on the type of constructor used. If you need anything more complex, or if you used the simple constructor, then you must override this method.

Specified by:
checkInputsNoBag in interface Function