Class Functions
java.lang.Object
com.northconcepts.datapipeline.core.Functions
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 TypeMethodDescriptionstatic voidCreates aliases for one or more public, static methods on the specified class using their simple names (for examplejava.lang.Math.abs()will be aliased asabs).static voidCreates a new alias for a public, static method on the specified class.static voidCreates a new alias for a fully-qualified, public, static method.static voidCreates aliases either for all public, static methods on the specified class and superclass using their simple names (for examplejava.lang.Math.abs()will be aliased asabs) or just the specified methods.static voidaddBlacklistPrefix(String... blacklistPrefixes) Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.static voidaddWhitelistPrefix(String... whitelistPrefixes) Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.static StringReturns the fully-qualified method name for a function alias ornull.static String[]Returns all the aliases.static intgetCount()Returns the number of aliased functions.static booleanisMethodBacklisted(String method) Returns true if the specified method starts with any of the blacklisted prefixes and does not start with a whitelisted prefix.static voidlog()Logs all aliased functions know to the expression language to the debug level.static voidreset(boolean clear) Re-add all the built-in function aliases, optionally clearing the registry first.
-
Method Details
-
add
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
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
Creates aliases for one or more public, static methods on the specified class using their simple names (for examplejava.lang.Math.abs()will be aliased asabs).- 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
Creates aliases either for all public, static methods on the specified class and superclass using their simple names (for examplejava.lang.Math.abs()will be aliased asabs) 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
Returns the fully-qualified method name for a function alias ornull. -
getCount
public static int getCount()Returns the number of aliased functions. -
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
Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.- Parameters:
whitelistPrefixes- the method prefixes to exclude.
-
addBlacklistPrefix
Prevents methods whose fully-qualified name starts with any of the supplied prefixes from executing.- Parameters:
blacklistPrefixes- the method prefixes to exclude.
-
isMethodBacklisted
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.
-