net.sf.swan.xpath.util
Class CompositeFunctionContext

java.lang.Object
  |
  +--net.sf.swan.xpath.util.CompositeFunctionContext
All Implemented Interfaces:
org.jaxen.FunctionContext

public class CompositeFunctionContext
extends java.lang.Object
implements org.jaxen.FunctionContext

FunctionContext that is a composite of other FunctionContexts, each tied to a URI. When created, this context is initialized with the default XPathFunctionContext tied to the empty "" namespace. This may be overridden by simply adding a different FunctionContext tied to the same namespace.

This can also resolve function references by attempting to match the function's URI to some base portion of a URI for a function library. Any matching library is given an opportunity to resolve the function reference until one succeeds or there are no futher matches.


Constructor Summary
CompositeFunctionContext()
           
 
Method Summary
 void addLibrary(java.lang.String namespaceURI, org.jaxen.FunctionContext library)
          Adds another FunctionContext as a library tied to the specified namespace URI.
 org.jaxen.Function getFunction(java.lang.String namespaceUri, java.lang.String prefix, java.lang.String localName)
           
protected  org.jaxen.Function resolveFunction(java.lang.String namespaceUri, java.lang.String prefix, java.lang.String localName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeFunctionContext

public CompositeFunctionContext()
Method Detail

getFunction

public org.jaxen.Function getFunction(java.lang.String namespaceUri,
                                      java.lang.String prefix,
                                      java.lang.String localName)
                               throws org.jaxen.UnresolvableException
Specified by:
getFunction in interface org.jaxen.FunctionContext

addLibrary

public void addLibrary(java.lang.String namespaceURI,
                       org.jaxen.FunctionContext library)
Adds another FunctionContext as a library tied to the specified namespace URI. This will override any previous bindings to that namespace.

resolveFunction

protected org.jaxen.Function resolveFunction(java.lang.String namespaceUri,
                                             java.lang.String prefix,
                                             java.lang.String localName)
                                      throws org.jaxen.UnresolvableException