Class FunctionLibrary

java.lang.Object
dev.metaschema.core.metapath.function.FunctionLibrary
All Implemented Interfaces:
IFunctionLibrary
Direct Known Subclasses:
DefaultFunctionLibrary

public class FunctionLibrary extends Object implements IFunctionLibrary
Provides a catalog of registered function implementations.

Functions can be registered using the registerFunction(IFunction) method.

Previously registered functions can be looked up using the getFunction(IEnhancedQName, int) method.

  • Constructor Details

    • FunctionLibrary

      public FunctionLibrary()
  • Method Details

    • registerFunction

      public final void registerFunction(@NonNull IFunction function)
      Register the provided function signature.
      Parameters:
      function - the function signature to register
      Throws:
      IllegalArgumentException - if the provided function has the same arity as a previously registered function with the same name
    • stream

      public Stream<IFunction> stream()
      Description copied from interface: IFunctionLibrary
      Retrieve the collection of function signatures in this library as a stream.
      Specified by:
      stream in interface IFunctionLibrary
      Returns:
      a stream of function signatures
    • getFunction

      public IFunction getFunction(@NonNull IEnhancedQName name, int arity)
      Description copied from interface: IFunctionLibrary
      Retrieve the function with the provided namespace qualified name that supports the signature of the provided arity, if such a function exists.
      Specified by:
      getFunction in interface IFunctionLibrary
      Parameters:
      name - the namespace qualified name of a group of functions
      arity - the count of arguments for use in determining an argument signature match
      Returns:
      the matching function or null if no match exists