public class BasicUtil
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
BasicUtil() |
Modifier and Type | Method and Description |
---|---|
IExecutable |
asExecutable(java.lang.Runnable runnable)
Converts the given runnable into an
IExecutable ; |
java.lang.Runnable |
asRunnable(IExecutable executable)
Converts the given executable into an
Runnable ; |
java.lang.String |
asString(java.lang.Object object)
Returns the string representation of the given object utilizing either asString()
if it implements
IStringRepresentation , name() if it is an enum value
or toString() for all other objects. |
<T> CompareResult |
compare(java.lang.Comparable<T> object1,
T object2)
Compares the first object to the second and returns an enum value for the result.
|
boolean |
containsWhitespaceChars(java.lang.String str)
Returns whether or not the given string contains any white space character.
|
static BasicUtil |
current() |
java.lang.Double |
firstValidValue(java.lang.Double... values)
Returns the first value of the given value array that is not NaN
or null if none found.
|
java.lang.Float |
firstValidValue(java.lang.Float... values)
Returns the first value of the given value array that is not NaN
or null if none found.
|
boolean |
isAnyNull(java.lang.Object... objects)
Returns true if the given array contains at least one null value.
|
boolean |
isAnyNullOrBlank(java.lang.String... strings)
Returns true if any one of the given strings is null or blank.
|
<T> boolean |
isEqual(java.lang.Comparable<T> object1,
T object2)
Returns whether or not the first given object is equal to the second.
|
<T> boolean |
isGreater(java.lang.Comparable<T> object1,
T object2)
Returns whether or not the first given object is greater than the second.
|
<T> boolean |
isLess(java.lang.Comparable<T> object1,
T object2)
Returns whether or not the first given object is less than the second.
|
boolean |
isNoneNull(java.lang.Object... objects)
Returns true if the given array contains no null value.
|
boolean |
isNoneNullOrBlank(java.lang.String... strings)
Returns true if none of the given strings is null or blank.
|
boolean |
isNullOrBlank(java.lang.String str)
Returns true if the given string is null or empty or consists of
whitespace characters only.
|
boolean |
isNullOrEmpty(java.util.Collection<?> collection)
Returns true if the given collection is null or has no elements.
|
boolean |
isNullOrEmpty(java.util.Map<?,?> map)
Returns true if the given map is null or has no elements.
|
boolean |
isNullOrEmpty(java.lang.Object[] array)
Returns true if the given array is null or has no elements.
|
boolean |
isNullOrEmpty(java.lang.String str)
Returns true if the given string is null or empty
|
boolean |
isNullOrEmpty(java.lang.String[] strings)
Returns true if the given string array is null or empty
|
boolean |
isTypeOf(java.lang.Object object,
java.lang.Class<?> type)
Returns whether or not the given object is exactly of the specified type.
|
boolean |
isTypeOrSubTypeOf(java.lang.Object object,
java.lang.Class<?> type)
Returns whether or not the given object is the same type as the specified type
of a sub-type of this type.
|
static void |
noop()
This method is intentionally doing nothing at all.
|
boolean |
notNullOrBlank(java.lang.String str)
Returns true if the given string is not null and not empty and does not
consist of whitespace characters only.
|
boolean |
notNullOrEmpty(java.lang.String str)
Returns true if the given string is not null and not empty.
|
public static final BasicUtil BU
public static BasicUtil current()
public static void noop()
public boolean isNoneNull(java.lang.Object... objects)
objects
- The array to check (must not be null).public boolean isAnyNull(java.lang.Object... objects)
objects
- The array to check (must not be null).public boolean isNullOrEmpty(java.util.Collection<?> collection)
collection
- The collection to checkpublic boolean isNullOrEmpty(java.lang.Object[] array)
array
- The array to checkpublic boolean isNullOrEmpty(java.util.Map<?,?> map)
map
- The map to checkpublic boolean isAnyNullOrBlank(java.lang.String... strings)
public boolean isNoneNullOrBlank(java.lang.String... strings)
public boolean isNullOrEmpty(java.lang.String[] strings)
strings
- The string array to checkpublic boolean isNullOrEmpty(java.lang.String str)
str
- The string to checkpublic boolean isNullOrBlank(java.lang.String str)
str
- The string to checkpublic boolean notNullOrEmpty(java.lang.String str)
str
- The string to check.public boolean notNullOrBlank(java.lang.String str)
str
- The string to check.public boolean containsWhitespaceChars(java.lang.String str)
str
- The string to check.public <T> boolean isLess(java.lang.Comparable<T> object1, T object2)
object1
- The object to be compared if it is less than the other object (must not be null).object2
- The object to be compared with (must not be null).public <T> boolean isEqual(java.lang.Comparable<T> object1, T object2)
object1
- The object to be compared if it is equal to the other object (must not be null).object2
- The object to be compared with (must not be null).public <T> boolean isGreater(java.lang.Comparable<T> object1, T object2)
object1
- The object to be compared if it is greater than the other object (must not be null).object2
- The object to be compared with (must not be null).public <T> CompareResult compare(java.lang.Comparable<T> object1, T object2)
object1
- The object to be compared to the other object (must not be null).object2
- The object to be compared with (must not be null).public java.lang.String asString(java.lang.Object object)
IStringRepresentation
, name() if it is an enum value
or toString() for all other objects.object
- The object to get the string representation for (may be null).public boolean isTypeOf(java.lang.Object object, java.lang.Class<?> type)
instanceof
checking because it
ignores inheritance.
Returns null if any of the arguments is null.public boolean isTypeOrSubTypeOf(java.lang.Object object, java.lang.Class<?> type)
public java.lang.Double firstValidValue(java.lang.Double... values)
public java.lang.Float firstValidValue(java.lang.Float... values)
public IExecutable asExecutable(java.lang.Runnable runnable)
IExecutable
;public java.lang.Runnable asRunnable(IExecutable executable)
Runnable
;