org.jaxen

Class SimpleFunctionContext

public class SimpleFunctionContext extends Object implements FunctionContext

Simple default implementation of FunctionContext.

This is a simple table-based key-lookup implementation for FunctionContext which can be programmatically extended by registering additional functions.

Author: bob mcwhirter

See Also:

Field Summary
HashMapfunctions
Table of functions.
Constructor Summary
SimpleFunctionContext()

Construct an empty function context.

Method Summary
FunctiongetFunction(String namespaceURI, String prefix, String localName)
voidregisterFunction(String namespaceURI, String localName, Function function)
Register a new function.

Field Detail

functions

private HashMap functions
Table of functions.

Constructor Detail

SimpleFunctionContext

public SimpleFunctionContext()

Construct an empty function context.

Method Detail

getFunction

public Function getFunction(String namespaceURI, String prefix, String localName)

registerFunction

public void registerFunction(String namespaceURI, String localName, Function function)
Register a new function.

By registering a new function, any XPath expression that utilizes this FunctionContext may refer to and use the new function.

Functions may exist either in a namespace or not. Namespace prefix-to-URI resolution is the responsibility of a {@link NamespaceContext}. Within this FunctionContext functions are only referenced using the URI, not the prefix.

The namespace URI of a function may be null to indicate that it exists without a namespace.

Parameters: namespaceURI the namespace URI of the function to be registered with this context localName the non-prefixed local portion of the function to be registered with this context function a {@link Function} implementation object to be used when evaluating the function