public final class Functions extends Object
abs()
instead of java.lang.Math.abs()
).Modifier and Type | Method and 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[] |
getAliases()
Returns all the aliases.
|
static int |
getCount()
Returns the number of aliased functions.
|
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.
|
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.
|
public static void add(String alias, String signature)
alias
- the short name used in expressions.signature
- the fully-qualified, public, static method.public static void add(String alias, Class<?> clazz, String methodName)
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).public static void add(Class<?> clazz, String methodName1, String... methodNames)
java.lang.Math.abs()
will be aliased as abs
).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).public static void addAll(Class<?> clazz, boolean includeSuperclasses, String... methodNames)
java.lang.Math.abs()
will be aliased as abs
) or just the specified methods.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.public static String get(String alias)
null
.public static int getCount()
public static String[] getAliases()
public static void reset(boolean clear)
public static void log()
public static void addWhitelistPrefix(String... whitelistPrefixes)
whitelistPrefixes
- the method prefixes to exclude.public static void addBlacklistPrefix(String... blacklistPrefixes)
blacklistPrefixes
- the method prefixes to exclude.public static boolean isMethodBacklisted(String method)
method
- the fully-qualified method to check.Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.