net.sf.joost.stx
Class FunctionTable.ExtensionFunction

java.lang.Object
  extended bynet.sf.joost.stx.FunctionTable.ExtensionFunction
All Implemented Interfaces:
FunctionTable.Instance
Enclosing class:
FunctionTable

public static final class FunctionTable.ExtensionFunction
extends Object
implements FunctionTable.Instance

An instance of this class represents a Java extension function. Parts of this code are taken from Michael Kay's Saxon XSLT processor implementation.


Field Summary
private  ArrayList candidateMethods
          possible methods, should differ at most in formal parameter types
private  boolean isConstructor
          true if this function call is a constructor invocation
private  int paramCount
          the number of provided parameters in the function call
private  Class targetClass
          the target class, identified by the namespace
 
Constructor Summary
FunctionTable.ExtensionFunction(String className, String lName, Tree args, Locator locator)
          Constructs a Java extension function.
 
Method Summary
 Value evaluate(Context context, int top, Tree args)
          find and call the correct Java method
 int getMaxParCount()
          Not called
 int getMinParCount()
          Not called
 String getName()
          Not called
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targetClass

private Class targetClass
the target class, identified by the namespace


candidateMethods

private ArrayList candidateMethods
possible methods, should differ at most in formal parameter types


paramCount

private int paramCount
the number of provided parameters in the function call


isConstructor

private boolean isConstructor
true if this function call is a constructor invocation

Constructor Detail

FunctionTable.ExtensionFunction

public FunctionTable.ExtensionFunction(String className,
                                       String lName,
                                       Tree args,
                                       Locator locator)
                                throws SAXParseException
Constructs a Java extension function.

Parameters:
className - the name of the Java class the function belongs to (taken from the namespace URI of the function call)
lName - the local name of the function call (may contain hyphens)
args - the supplied function parameters
locator - the Locator object
Throws:
SAXParseException - if there's no proper function
Method Detail

evaluate

public Value evaluate(Context context,
                      int top,
                      Tree args)
               throws SAXException,
                      EvalException
find and call the correct Java method

Specified by:
evaluate in interface FunctionTable.Instance
Parameters:
context - the Context object
top - the number of the upper most element on the stack
args - the current parameters
Returns:
a Value instance containing the result
Throws:
EvalException - if an error occurs while processing
SAXException - if an error occurs while processing

getMinParCount

public int getMinParCount()
Not called

Specified by:
getMinParCount in interface FunctionTable.Instance

getMaxParCount

public int getMaxParCount()
Not called

Specified by:
getMaxParCount in interface FunctionTable.Instance

getName

public String getName()
Not called

Specified by:
getName in interface FunctionTable.Instance