Package org.togglz.core.util
Class Strings
java.lang.Object
org.togglz.core.util.Strings
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static boolean
Returns whether the specified string is empty while remaining null-safe.static boolean
isNotBlank
(String s) static boolean
isNotEmpty
(String s) Returns whether the specified string is not empty while remaining null-safe.static String
static String
joinClassNames
(Iterable<?> iterable) splitAndTrim
(String value, String regex) static Boolean
Attempts to return the best boolean representation for the specified string while remaining null-safe and ignoring any leading/trailing whitespace as well as case.static String
Trims the specified string while remaining null-safe.static String
trimToNull
(String s) Trims the specified string and, if the resulting string is empty, will return null instead.
-
Constructor Details
-
Strings
public Strings()
-
-
Method Details
-
join
-
isBlank
-
isNotBlank
-
isEmpty
Returns whether the specified string is empty while remaining null-safe.
- Parameters:
s
- the string to be checked (may be null)- Returns:
- true if
s
is either null or contains no characters.
-
isNotEmpty
Returns whether the specified string is not empty while remaining null-safe.
- Parameters:
s
- the string to be checked (may be null)- Returns:
- true if
s
is not null and contains at least one character.
-
splitAndTrim
-
trim
Trims the specified string while remaining null-safe.
- Parameters:
s
- the string to be trimmed (may be null)- Returns:
- The trimmed
s
or null ifs
is null.
-
trimToNull
Trims the specified string and, if the resulting string is empty, will return null instead.
- Parameters:
s
- the string to be trimmed (may be null)- Returns:
- The trimmed
s
or null ifs
is null before or after being trimmed.
-
joinClassNames
-
toBoolean
Attempts to return the best boolean representation for the specified string while remaining null-safe and ignoring any leading/trailing whitespace as well as case.
This method simply uses a set of predefined values that it compares
s
to in order to determine the bestBoolean
representation. Ifs
does not fall into either category, it is considered invalid and will result in anIllegalArgumentException
being thrown.- Parameters:
s
- the string to be converted into aBoolean
- Returns:
- The
Boolean
representation ofs
or null ifs
is null. - Throws:
IllegalArgumentException
- Ifs
is non-null and does not match any of the predefined values.
-