jd.xml.xslt.extension
Class ScriptExtensionHandler
java.lang.Object
jd.xml.xslt.extension.ExtensionHandler
jd.xml.xslt.extension.ScriptExtensionHandler
- public class ScriptExtensionHandler
- extends ExtensionHandler
An ExtensionHandler that maps extension functions to functions
of a scripting language like javascript or vbscript.
It is defined by a script-element. For instance
>
function helloWorld()
{
return "Hello World";
}
>
allows expressions to use the javascript functions:
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScriptExtensionHandler
public ScriptExtensionHandler(String namespaceUri,
String language)
- Create a ScriptExtensionHandler
- Parameters:
namespaceUri - the namespace uri of this ExtensionHandler
getLanguage
public String getLanguage()
- Return the script language of this ExtensionHandler.
addScript
public void addScript(String script)
throws BSFException
- Add another script.
- Throws:
BSFException
isElementAvailable
public boolean isElementAvailable(String name)
- Return if an extension element is available.
- Specified by:
isElementAvailable in class ExtensionHandler
getFunction
public Function getFunction(XsltContext context,
String functionName,
Expression[] arguments)
- Return a extension function for the given name.
- Specified by:
getFunction in class ExtensionHandler
- Parameters:
arguments - the arguments passed to the methodfunctionName - the function name
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.