|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.beesoft.gaia.util.Objects
public final class Objects
Utility class developed to make some operations with objects easier.
Method Summary | |
---|---|
static java.lang.Object |
convert(java.lang.Object object,
java.lang.Class<?> targetType)
Converts given object to the instance of given
targetType . |
static boolean |
equals(java.lang.Object obj1,
java.lang.Object obj2)
Compares two objects and returns true if: they both are null they are identical they are equal The goal of this method is you don't need take a care about null values. |
static java.lang.Class<?>[] |
getTypes(java.lang.Object... arg)
Returns array of classes of objects that are in arg array. |
static int |
hashCode(java.lang.Object... object)
Computes hash code from given object(s). |
static boolean |
isEmpty(java.util.Collection<?> collection)
Returns true if given collection is null or is empty. |
static boolean |
isEmpty(java.util.Map<?,?> map)
Returns true if given map is null or is empty. |
static boolean |
isEmpty(java.lang.Object object)
Returns true if given object is null or is empty. |
static boolean |
isEmpty(java.lang.Object[] array)
Returns true if given array is null or is empty or contains
only null values. |
static boolean |
isEmpty(java.lang.String string)
Returns true if given string is null, is empty String or
contains only whitespace characters. |
static java.lang.String |
toString(java.lang.Object object)
Returns a text representation of the given object . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String toString(java.lang.Object object)
object
. If object
is null, returns empty String. If object is a String return it self.
Otherwise calls toString() method on the object.
object
- - the object, may be null
public static int hashCode(java.lang.Object... object)
object
- - the object(s) to calculate hash code, any if them may be
null
public static boolean equals(java.lang.Object obj1, java.lang.Object obj2)
obj1
- - first object to compareobj2
- - second object to compare
public static java.lang.Class<?>[] getTypes(java.lang.Object... arg)
arg
array.
In the source array can be null values, then is null on the appropriate
position in the output array, too. If in source array is class, it is
stored to output array.
arg
- - array of objects, may be null
public static java.lang.Object convert(java.lang.Object object, java.lang.Class<?> targetType)
object
to the instance of given
targetType
. Currently it supports these conversions:
object
- - object to converttargetType
- - instance of this class is required to return
java.lang.RuntimeException
- if cannot convertpublic static boolean isEmpty(java.lang.String string)
string
is null, is empty String or
contains only whitespace characters.
string
- - String to check
public static boolean isEmpty(java.util.Collection<?> collection)
collection
is null or is empty.
collection
- - collection to check
public static boolean isEmpty(java.util.Map<?,?> map)
map
is null or is empty.
map
- - map to check
public static boolean isEmpty(java.lang.Object[] array)
array
is null or is empty or contains
only null values.
array
- - array to check
public static boolean isEmpty(java.lang.Object object)
object
is null or is empty. Dispatches
this task to the appropriate isEmpty() method in dependency on the type
of object. Returns false, if object is not null, String, Collection, Map
or Object array.
object
- - object to check
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |