Class Functions

java.lang.Object
com.northconcepts.datapipeline.core.Functions

public final class Functions extends Object
Functions is the entry point for adding new method aliases to the dynamic expression language. An alias is a short name used to reference a fully-qualified, public, static method (for example abs() instead of java.lang.Math.abs()).
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    add(Class<?> clazz, String methodName1, String... methodNames)
    Creates aliases for one or more public, static methods on the specified class using their simple names (for example java.lang.Math.abs() will be aliased as abs).
    static void
    add(String alias, Class<?> clazz, String methodName)
    Creates a new alias for a public, static method on the specified class.
    static void
    add(String alias, String signature)
    Creates a new alias for a fully-qualified, public, static method.
    static void
    addAll(Class<?> clazz, boolean includeSuperclasses, String... methodNames)
    Creates aliases either for all public, static methods on the specified class and superclass using their simple names (for example java.lang.Math.abs() will be aliased as abs) or just the specified methods.
    static void
    addBlacklistPrefix(String... blacklistPrefixes)
    Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.
    static void
    addWhitelistPrefix(String... whitelistPrefixes)
    Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.
    static String
    get(String alias)
    Returns the fully-qualified method name for a function alias or null.
    static String[]
    Returns all the aliases.
    static int
    Returns the number of aliased functions.
    static boolean
    Returns true if the specified method starts with any of the blacklisted prefixes and does not start with a whitelisted prefix.
    static void
    log()
    Logs all aliased functions know to the expression language to the debug level.
    static void
    reset(boolean clear)
    Re-add all the built-in function aliases, optionally clearing the registry first.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • add

      public static void add(String alias, String signature)
      Creates a new alias for a fully-qualified, public, static method.
      Parameters:
      alias - the short name used in expressions.
      signature - the fully-qualified, public, static method.
    • add

      public static void add(String alias, Class<?> clazz, String methodName)
      Creates a new alias for a public, static method on the specified class.
      Parameters:
      alias - the short name used in expressions.
      clazz - the class to search for methodName.
      methodName - the public, static method name (not fully-qualified, doesn't include the class or package names).
    • add

      public static void add(Class<?> clazz, String methodName1, String... methodNames)
      Creates aliases for one or more public, static methods on the specified class using their simple names (for example java.lang.Math.abs() will be aliased as abs).
      Parameters:
      clazz - the class to search for method names.
      methodName1 - the first public, static method name (not fully-qualified, doesn't include the class or package names).
      methodNames - subsequent public, static method name (not fully-qualified, doesn't include the class or package names).
    • addAll

      public static void addAll(Class<?> clazz, boolean includeSuperclasses, String... methodNames)
      Creates aliases either for all public, static methods on the specified class and superclass using their simple names (for example java.lang.Math.abs() will be aliased as abs) or just the specified methods.
      Parameters:
      clazz - the class to search for method names.
      includeSuperclasses - indicates if public, static methods on super classes should be included.
      methodNames - the specified public, static methods to add or all if none are specified.
    • get

      public static String get(String alias)
      Returns the fully-qualified method name for a function alias or null.
    • getCount

      public static int getCount()
      Returns the number of aliased functions.
    • getAliases

      public static String[] getAliases()
      Returns all the aliases.
    • reset

      public static void reset(boolean clear)
      Re-add all the built-in function aliases, optionally clearing the registry first.
    • log

      public static void log()
      Logs all aliased functions know to the expression language to the debug level.
    • addWhitelistPrefix

      public static void addWhitelistPrefix(String... whitelistPrefixes)
      Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.
      Parameters:
      whitelistPrefixes - the method prefixes to exclude.
    • addBlacklistPrefix

      public static void addBlacklistPrefix(String... blacklistPrefixes)
      Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.
      Parameters:
      blacklistPrefixes - the method prefixes to exclude.
    • isMethodBacklisted

      public static boolean isMethodBacklisted(String method)
      Returns true if the specified method starts with any of the blacklisted prefixes and does not start with a whitelisted prefix.
      Parameters:
      method - the fully-qualified method to check.