com.icl.saxon.expr
Class FunctionProxy

java.lang.Object
  |
  +--com.icl.saxon.expr.Expression
        |
        +--com.icl.saxon.expr.Function
              |
              +--com.icl.saxon.expr.FunctionProxy

public class FunctionProxy
extends Function

This class acts as a proxy for an extension function defined as a method in a user-defined class


Fields inherited from class com.icl.saxon.expr.Function
argument
 
Fields inherited from class com.icl.saxon.expr.Expression
staticContext
 
Constructor Summary
FunctionProxy()
          Constructor: creates an uncommitted FunctionProxy
 
Method Summary
static Value convertJavaObjectToXPath(java.lang.Object result)
           
 Value evaluate(Context context)
          Evaluate the function.
 int getDataType()
          Determine the data type of the expression, if possible
 int getDependencies()
          Determine which aspects of the context the expression depends on.
 java.lang.String getName()
          Get the name of the function
 Expression reduce(int dependencies, Context context)
          Perform a partial evaluation of the expression, by eliminating specified dependencies on the context.
 boolean setMethod(java.lang.String uri, java.lang.String localName)
          setMethod: locates the external class and method to which this function relates.
 Expression simplify()
          Simplify the function (by simplifying its arguments)
 
Methods inherited from class com.icl.saxon.expr.Function
addArgument, checkArgumentCount, getNumberOfArguments, toString
 
Methods inherited from class com.icl.saxon.expr.Expression
containsReferences, enumerate, evaluateAsBoolean, evaluateAsNodeSet, evaluateAsNumber, evaluateAsString, getStaticContext, make, outputStringValue, setStaticContext, usesCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FunctionProxy

public FunctionProxy()
Constructor: creates an uncommitted FunctionProxy
Method Detail

setMethod

public boolean setMethod(java.lang.String uri,
                         java.lang.String localName)
setMethod: locates the external class and method to which this function relates. At this stage addArguments() will have normally been called, so the number of arguments is known. If no method of the required name is located, an exception is saved, but it is not thrown until an attempt is made to evaluate the function. The method is also used before calling function-available(). In this case the number of arguments is not known (it will be set to zero). We return true if a match was found, regardless of the number of arguments.
Parameters:
fullName - This identifies both the local name of the function and its namespace.
Returns:
true if the function is available (with some number of arguments).

getDataType

public int getDataType()
Determine the data type of the expression, if possible
Overrides:
getDataType in class Expression
Returns:
Value.ANY (meaning not known in advance)

getName

public java.lang.String getName()
Get the name of the function
Overrides:
getName in class Function
Following copied from class: com.icl.saxon.expr.Function
Returns:
the name of the function, as used in XSL expressions, but excluding its namespace prefix

simplify

public Expression simplify()
                    throws org.xml.sax.SAXException
Simplify the function (by simplifying its arguments)
Overrides:
simplify in class Expression
Following copied from class: com.icl.saxon.expr.Expression
Returns:
the simplified expression

getDependencies

public int getDependencies()
Determine which aspects of the context the expression depends on. The result is a bitwise-or'ed value composed from constants such as Context.VARIABLES and Context.CURRENT_NODE
Overrides:
getDependencies in class Expression

reduce

public Expression reduce(int dependencies,
                         Context context)
                  throws org.xml.sax.SAXException
Perform a partial evaluation of the expression, by eliminating specified dependencies on the context.
Overrides:
reduce in class Expression
Parameters:
dependencies - The dependencies to be removed
context - The context to be used for the partial evaluation
Returns:
a new expression that does not have any of the specified dependencies

evaluate

public Value evaluate(Context context)
               throws org.xml.sax.SAXException
Evaluate the function.
Overrides:
evaluate in class Expression
Parameters:
context - The context in which the function is to be evaluated
Returns:
a Value representing the result of the function.
Throws:
org.xml.sax.SAXException - if the function cannot be evaluated.

convertJavaObjectToXPath

public static Value convertJavaObjectToXPath(java.lang.Object result)
                                      throws org.xml.sax.SAXException