Class FunctionDirectory


  • public class FunctionDirectory
    extends java.lang.Object
    This class is a directory of all functions recognized within NanoDB, including simple functions, aggregate functions and table functions. Generally there will be one function directory per NanoDBServer object, used for that server.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.ConcurrentHashMap<java.lang.String,​java.lang.Class<? extends Function>> functions
      This map holds the association of function names to their implementations.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFunction​(java.lang.String funcName, java.lang.Class<? extends Function> impl)
      Add a function to the directory.
      Function getFunction​(java.lang.String funcName)
      If the specified function name corresponds to an existing function, this method instantiates a new object that can compute the function, and then returns it.
      private void initBuiltinFunctions()
      This helper function initializes all of the built-in functions that are part of NanoDB.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • functions

        private java.util.concurrent.ConcurrentHashMap<java.lang.String,​java.lang.Class<? extends Function>> functions
        This map holds the association of function names to their implementations.
    • Constructor Detail

      • FunctionDirectory

        public FunctionDirectory()
    • Method Detail

      • initBuiltinFunctions

        private void initBuiltinFunctions()
        This helper function initializes all of the built-in functions that are part of NanoDB.
      • addFunction

        public void addFunction​(java.lang.String funcName,
                                java.lang.Class<? extends Function> impl)
        Add a function to the directory. The function's name is trimmed and converted to uppercase before updating the directory. If the directory already contains a function with the specified name, an exception is reported.
        Parameters:
        funcName - the name of the function
        impl - the Function object that implements this function
        Throws:
        java.lang.IllegalArgumentException - if the name or implementation is null, or if the function already appears in the directory
      • getFunction

        public Function getFunction​(java.lang.String funcName)
        If the specified function name corresponds to an existing function, this method instantiates a new object that can compute the function, and then returns it.
        Parameters:
        funcName - the name of the function to get
        Returns:
        an object that can compute the function