jd.xml.xslt.extension
Class JavaExtensionHandler

java.lang.Object
  extended byjd.xml.xslt.extension.ExtensionHandler
      extended byjd.xml.xslt.extension.JavaExtensionHandler
Direct Known Subclasses:
JdExtensionHandler

public class JavaExtensionHandler
extends ExtensionHandler

An ExtensionHandler that maps extension functions to java methods. It is defined by a script-element. For instance

      
      
 
 allows expressions to use the methods of java.lang.Math:
 
      
 


Constructor Summary
JavaExtensionHandler(String namespaceUri, Class javaClass)
          Create a JavaExtensionHandler
 
Method Summary
 Function getFunction(XsltContext context, String methodName, Expression[] arguments)
          Return an extension function for the given name.
 boolean isElementAvailable(String name)
          Return if an extension element is available.
 boolean isFunctionAvailable(String name)
          Return if the associated java class has a method with the given name If true this does not guarantee that the method can be called successfully.
 
Methods inherited from class jd.xml.xslt.extension.ExtensionHandler
camelCaseName, implementsUri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaExtensionHandler

public JavaExtensionHandler(String namespaceUri,
                            Class javaClass)
Create a JavaExtensionHandler

Parameters:
namespaceUri - the namespace uri of this ExtensionHandler
javaClass - the extension functions handled by this ExtensionHandlers are methods of this class
Method Detail

isElementAvailable

public boolean isElementAvailable(String name)
Return if an extension element is available.

Specified by:
isElementAvailable in class ExtensionHandler

isFunctionAvailable

public boolean isFunctionAvailable(String name)
Return if the associated java class has a method with the given name If true this does not guarantee that the method can be called successfully.

Specified by:
isFunctionAvailable in class ExtensionHandler
Parameters:
name - the method name. If it equals "new" it is tested whether the class has a constructor.

getFunction

public Function getFunction(XsltContext context,
                            String methodName,
                            Expression[] arguments)
Return an extension function for the given name.

Specified by:
getFunction in class ExtensionHandler
Parameters:
context - the current evaluation context
methodName - a method name
arguments - the arguments passed to the method