com.novell.xml.xpath
Class FunctionSignature

java.lang.Object
  extended bycom.novell.xml.xpath.FunctionSignature

public class FunctionSignature
extends Object

This class implements a function signature for XPath functions. A function signature consists in the abstract of a function name, a return type, and the numbers and types of any arguments. This class implements the signature using a String for the name, and Class objects for the types. The argument types are stored in required and optional argument arrays; the numbers of arguments are found in the sizes of the arrays.

See Also:
Function, FunctionCall

Constructor Summary
FunctionSignature(ExpandedQName name, Class returnType)
          Construct a function signature for a function taking no arguments
FunctionSignature(ExpandedQName name, Class returnType, Class[] arguments)
          Construct a function signature for a function taking a fixed number of required arguments
FunctionSignature(ExpandedQName name, Class returnType, Class[] requiredArguments, Class[] optionalArguments)
          Construct a function signature for a function taking a fixed number (including zero) of required arguments and 1 or more optional arguments
 
Method Summary
static Class[] getContextArgTypes()
          A convenience function that returns an array with the number and type of arguments for built-in functions that need the current expression evaluation context.
 ExpandedQName getName()
          Return the name of the function represented by this signature
 Class[] getOptionalArgs()
          Return the array of optional arguments.
 Class[] getRequiredArgs()
          Return the array of required arguments.
 Class getReturnType()
          Return the Class object representing the function return type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionSignature

public FunctionSignature(ExpandedQName name,
                         Class returnType)
Construct a function signature for a function taking no arguments

Parameters:
name - The name of the function
returnType - The Class object representing the return type of the function. This must be a class that implements the ExpressionValue interface.

FunctionSignature

public FunctionSignature(ExpandedQName name,
                         Class returnType,
                         Class[] arguments)
Construct a function signature for a function taking a fixed number of required arguments

Parameters:
name - The name of the function
returnType - The Class object representing the return type of the function. This
arguments - An array of Class objects representing the types of the arguments must be a class that implements the ExpressionValue interface.

FunctionSignature

public FunctionSignature(ExpandedQName name,
                         Class returnType,
                         Class[] requiredArguments,
                         Class[] optionalArguments)
Construct a function signature for a function taking a fixed number (including zero) of required arguments and 1 or more optional arguments

Parameters:
name - The name of the function
returnType - The Class object representing the return type of the function. This
requiredArguments - An array of Class objects representing the types of the arguments
optionalArguments - An array of Class objects representing the types of optional arguments must be a class that implements the ExpressionValue interface.
Method Detail

getName

public ExpandedQName getName()
Return the name of the function represented by this signature

Returns:
The function name

getRequiredArgs

public Class[] getRequiredArgs()
Return the array of required arguments. This will never return null, but the array may be zero-length.

Returns:
An array of Class objects representing the function's required arguments.

getOptionalArgs

public Class[] getOptionalArgs()
Return the array of optional arguments. This will never return null, but the array may be zero-length.

Returns:
An array of Class objects representing the function's optional arguments.

getReturnType

public Class getReturnType()
Return the Class object representing the function return type.

Returns:
Class object representing the function return type

getContextArgTypes

public static Class[] getContextArgTypes()
A convenience function that returns an array with the number and type of arguments for built-in functions that need the current expression evaluation context. The expression context consists of a DOM node (org.w3c.dom.Node) and an ExpressionContext object (com.novell.xml.xpath.ExpressionContext). Built-in functions can use this function to help construct their signatures.

Returns:
A two-element array with Class objects representing Node and ExpressionContext types.