Class FunctionLibrary

java.lang.Object
org.apache.commons.jxpath.FunctionLibrary
All Implemented Interfaces:
Functions

public class FunctionLibrary extends Object implements Functions
An object that aggregates Functions objects into a group Functions object. Since JXPathContext can only register a single Functions object, FunctionLibrary should always be used to group all Functions objects that need to be registered.
  • Field Details

  • Constructor Details

    • FunctionLibrary

      public FunctionLibrary()
      Constructs a new instance.
  • Method Details

    • addFunctions

      public void addFunctions(Functions functions)
      Add functions to the library
      Parameters:
      functions - to add
    • functionCache

      private Map<String,Object> functionCache()
      Prepare the cache.
      Returns:
      cache map keyed by namespace
    • getFunction

      public Function getFunction(String namespace, String name, Object[] parameters)
      Gets a Function, if any, for the specified namespace, name and parameter types.
      Specified by:
      getFunction in interface Functions
      Parameters:
      namespace - function namespace
      name - function name
      parameters - parameters
      Returns:
      Function found
    • getUsedNamespaces

      public Set<String> getUsedNamespaces()
      Gets a set containing all namespaces used by the aggregated Functions.
      Specified by:
      getUsedNamespaces in interface Functions
      Returns:
      a set containing all namespaces used by the aggregated Functions.
    • removeFunctions

      public void removeFunctions(Functions functions)
      Removes functions from the library.
      Parameters:
      functions - to remove.