public class BuiltInFunctions
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BuiltInFunctions.GenerateConditionalGFunctionClass |
static class |
BuiltInFunctions.GenerateGFunctionClass |
| Constructor and Description |
|---|
BuiltInFunctions() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
allMatch(java.lang.String key1,
java.lang.String key2)
allMatch determines whether key1 matches the pattern of key2 , key2 can contain a *.
|
static boolean |
eval(java.lang.String eval,
java.util.Map<java.lang.String,java.lang.Object> env,
com.googlecode.aviator.AviatorEvaluatorInstance aviatorEval)
eval calculates the stringified boolean expression and return its result.
|
static boolean |
globMatch(java.lang.String key1,
java.lang.String key2)
globMatch determines whether key1 matches the pattern of key2 in glob expression.
|
static boolean |
ipMatch(java.lang.String ip1,
java.lang.String ip2)
ipMatch determines whether IP address ip1 matches the pattern of IP address ip2, ip2 can be
an IP address or a CIDR pattern.
|
static java.lang.String |
keyGet2Func(java.lang.String key1,
java.lang.String key2,
java.lang.String pathVar)
KeyGet2 returns value matched pattern.For example, "/resource1" matches "/:resource", if the pathVar == "resource", then "resource1" will be returned.
|
static java.lang.String |
keyGetFunc(java.lang.String key1,
java.lang.String key2)
KeyGet returns the matched part.
|
static boolean |
keyMatch(java.lang.String key1,
java.lang.String key2)
keyMatch determines whether key1 matches the pattern of key2 (similar to RESTful path), key2
can contain a *.
|
static boolean |
keyMatch2(java.lang.String key1,
java.lang.String key2)
keyMatch2 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2
can contain a *.
|
static boolean |
keyMatch3(java.lang.String key1,
java.lang.String key2)
keyMatch3 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2
can contain a *.
|
static boolean |
keyMatch4(java.lang.String key1,
java.lang.String key2)
KeyMatch4 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2
can contain a *.
|
static boolean |
keyMatch5(java.lang.String key1,
java.lang.String key2)
KeyMatch5 determines whether key1 matches the pattern of key2 and ignores the parameters in key2.
|
static boolean |
regexMatch(java.lang.String key1,
java.lang.String key2)
regexMatch determines whether key1 matches the pattern of key2 in regular expression.
|
static boolean |
timeMatch(java.lang.String startTime,
java.lang.String endTime)
TimeMatch determines whether the current time is between startTime and endTime.
|
static boolean |
timeMatchFunc(java.lang.String... args)
timeMatchFunc is the wrapper for TimeMatch.
|
static void |
validateVariadicStringArgs(int expectedLen,
java.lang.String... args)
validate the variadic string parameter size
|
public static void validateVariadicStringArgs(int expectedLen,
java.lang.String... args)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static boolean keyMatch(java.lang.String key1,
java.lang.String key2)
For example, "/foo/bar" matches "/foo/*"
key1 - the first argument.key2 - the second argument.public static boolean keyMatch2(java.lang.String key1,
java.lang.String key2)
For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/:resource"
key1 - the first argument.key2 - the second argument.public static boolean keyMatch3(java.lang.String key1,
java.lang.String key2)
For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/{resource}"
key1 - the first argument.key2 - the second argument.public static boolean keyMatch4(java.lang.String key1,
java.lang.String key2)
"/parent/123/child/123" matches "/parent/{id}/child/{id}"
"/parent/123/child/456" does not match "/parent/{id}/child/{id}"
But KeyMatch3 will match both.
Attention: key1 cannot contain English commas.key1 - the first argument.key2 - the second argument.public static boolean keyMatch5(java.lang.String key1,
java.lang.String key2)
For example, "/foo/bar?status=1&type=2" matches "/foo/bar"
key1 - the first argument.key2 - the second argument.public static java.lang.String keyGetFunc(java.lang.String key1,
java.lang.String key2)
key1 - the first argument.key2 - the second argument.public static java.lang.String keyGet2Func(java.lang.String key1,
java.lang.String key2,
java.lang.String pathVar)
key1 - the first argument.key2 - the second argument.public static boolean regexMatch(java.lang.String key1,
java.lang.String key2)
key1 - the first argument.key2 - the second argument.public static boolean ipMatch(java.lang.String ip1,
java.lang.String ip2)
ip1 - the first argument.ip2 - the second argument.public static boolean globMatch(java.lang.String key1,
java.lang.String key2)
key1 - the first argument.key2 - the second argument.public static boolean allMatch(java.lang.String key1,
java.lang.String key2)
For example, "*" matches everything
key1 - the first argument.key2 - the second argument.public static boolean eval(java.lang.String eval,
java.util.Map<java.lang.String,java.lang.Object> env,
com.googlecode.aviator.AviatorEvaluatorInstance aviatorEval)
eval - the stringified boolean expression.env - the key-value pair of the parameters in the expression.aviatorEval - the AviatorEvaluatorInstance object which contains built-in functions and custom functions.public static boolean timeMatchFunc(java.lang.String... args)
public static boolean timeMatch(java.lang.String startTime,
java.lang.String endTime)
Copyright © 2017–2024. All rights reserved.