Package com.sodius.oslc.core.util
Class Strings
- java.lang.Object
-
- com.sodius.oslc.core.util.Strings
-
@Deprecated(since="3.12.0", forRemoval=true) public class Strings extends Object
Deprecated, for removal: This API element is subject to removal in a future version.useStringsUtility class to handleStringcommon methods- Since:
- 3.7.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanisEmpty(String string)Deprecated, for removal: This API element is subject to removal in a future version.Returnstrueif the given string isnullor is the empty string.static booleannonEmpty(String string)Deprecated, for removal: This API element is subject to removal in a future version.Returnstrueif the given string is nornullnor is the empty string.static StringrequireNonEmpty(String string)Deprecated, for removal: This API element is subject to removal in a future version.Checks that the specified string is notnullnor the empty string.static StringrequireNonEmpty(String string, String message)Deprecated, for removal: This API element is subject to removal in a future version.Checks that the specified string is notnullnor the empty string and throws a customizedNullPointerExceptionif it is.
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(String string)
Deprecated, for removal: This API element is subject to removal in a future version.Returnstrueif the given string isnullor is the empty string.- Parameters:
string- a string reference to check- Returns:
trueif the string isnullor is the empty string
-
nonEmpty
public static boolean nonEmpty(String string)
Deprecated, for removal: This API element is subject to removal in a future version.Returnstrueif the given string is nornullnor is the empty string.- Parameters:
string- a string reference to check- Returns:
trueif the string is notnullnor is the empty string
-
requireNonEmpty
public static String requireNonEmpty(String string)
Deprecated, for removal: This API element is subject to removal in a future version.Checks that the specified string is notnullnor the empty string. This method is designed primarily for doing parameter validation in methods and constructors, as demonstrated below:public Foo(String bar) { this.bar = Strings.requireNonEmpty(bar); }- Parameters:
string- the string to check for nullity and emptiness- Returns:
stringif notnullnor empty- Throws:
NullPointerException- ifstringisnullor the empty string
-
requireNonEmpty
public static String requireNonEmpty(String string, String message)
Deprecated, for removal: This API element is subject to removal in a future version.Checks that the specified string is notnullnor the empty string and throws a customizedNullPointerExceptionif it is. This method is designed primarily for doing parameter validation in methods and constructors, as demonstrated below:public Foo(String bar) { this.bar = Strings.requireNonEmpty(bar, "bar must not be null nor empty"); }- Parameters:
string- the string to check for nullity and emptinessmessage- detail message to be used in the event that aNullPointerExceptionis thrown- Returns:
stringif notnullnor empty- Throws:
NullPointerException- ifstringisnullor the empty string
-
-