Class Util
java.lang.Object
org.casbin.jcasbin.util.Util
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanarray2DEquals determines whether two 2-dimensional string arrays are identical.static booleanarrayEquals(List<String> a, List<String> b) arrayEquals determines whether two string arrays are identical.arrayRemoveDuplicates removes any duplicated elements in a string array preserving the order.static StringarrayToString(List<String> s) arrayToString gets a printable string for a string array.static StringconvertInSyntax(String expString) convertInSyntax Convert 'in' to 'include' to fit aviatorscript,because aviatorscript don't support native 'in' syntaxstatic StringescapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names.private static MessageDigeststatic booleanstatic booleanisJsonString(String str) Helper method to check if a string is a valid JSONstatic voidlogEnforce(Object[] request, boolean result, List<String> explain) logEnforce prints the log of Enforce.static voidlogPrint prints the log.static voidlogPrintf prints the log with the format.static voidlogPrintfError(String format, Object... v) logPrintf prints the log with the format as an error.static voidlogPrintfError(String message, Throwable t) logPrintf prints the log with the format as an error.static voidlogPrintfWarn(String format, Object... v) logPrintf prints the log with the format as a warning.static Stringstatic StringparamsToString(String[] s) paramsToString gets a printable string for variable number of parameters.static StringremoveComments removes the comments starting with # in the text.static StringreplaceEval(String s, String replacement) static booleansetEquals determines whether two string sets are identical.static String[]splitCommaDelimited splits a comma-delimited string according to the default processing method of the CSV file into a string array.
-
Field Details
-
enableLog
public static boolean enableLog -
evalReg
-
escapeAssertionRegex
-
LOGGER
private static org.slf4j.Logger LOGGER -
md5AlgorithmName
- See Also:
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
logPrint
-
logPrintf
-
logPrintfWarn
-
logPrintfError
-
logPrintfError
-
logEnforce
-
escapeAssertion
-
convertInSyntax
-
removeComments
-
arrayEquals
-
array2DEquals
-
arrayRemoveDuplicates
-
arrayToString
-
paramsToString
-
splitCommaDelimited
splitCommaDelimited splits a comma-delimited string according to the default processing method of the CSV file into a string array. It assumes that any number of whitespace might exist before or after the token and that tokens do not include whitespace as part of their value unless they are enclosed by double quotes.- Parameters:
s- the string.- Returns:
- the array with the string tokens.
-
setEquals
-
hasEval
-
replaceEval
-
md5
-
getDigest
-
isJsonString
Helper method to check if a string is a valid JSON- Parameters:
str- the string to be checked.- Returns:
- whether the string is a valid
-