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.useStrings
Utility class to handleString
common methods- Since:
- 3.7.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
isEmpty(String string)
Deprecated, for removal: This API element is subject to removal in a future version.Returnstrue
if the given string isnull
or is the empty string.static boolean
nonEmpty(String string)
Deprecated, for removal: This API element is subject to removal in a future version.Returnstrue
if the given string is nornull
nor is the empty string.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 notnull
nor the empty string.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 notnull
nor the empty string and throws a customizedNullPointerException
if 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.Returnstrue
if the given string isnull
or is the empty string.- Parameters:
string
- a string reference to check- Returns:
true
if the string isnull
or 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.Returnstrue
if the given string is nornull
nor is the empty string.- Parameters:
string
- a string reference to check- Returns:
true
if the string is notnull
nor 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 notnull
nor 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:
string
if notnull
nor empty- Throws:
NullPointerException
- ifstring
isnull
or 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 notnull
nor the empty string and throws a customizedNullPointerException
if 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 aNullPointerException
is thrown- Returns:
string
if notnull
nor empty- Throws:
NullPointerException
- ifstring
isnull
or the empty string
-
-