@Deprecated
public abstract class ObjectUtils
extends java.lang.Object
| Constructor and Description |
|---|
ObjectUtils()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static <A,O extends A> |
addObjectToArray(A[] array,
O obj)
Deprecated.
Append the given object to the given array, returning a new array consisting of the input array contents plus the
given object.
|
static <E extends java.lang.Enum<?>> |
caseInsensitiveValueOf(E[] enumValues,
java.lang.String constant)
Deprecated.
Case insensitive alternative to
Enum.valueOf(Class, String). |
static boolean |
containsConstant(java.lang.Enum<?>[] enumValues,
java.lang.String constant)
Deprecated.
Check whether the given array of enum constants contains a constant with the given name, ignoring case when
determining a match.
|
static boolean |
containsConstant(java.lang.Enum<?>[] enumValues,
java.lang.String constant,
boolean caseSensitive)
Deprecated.
Check whether the given array of enum constants contains a constant with the given name.
|
static boolean |
containsElement(java.lang.Object[] array,
java.lang.Object element)
Deprecated.
Check whether the given array contains the given element.
|
static java.lang.String |
getDisplayString(java.lang.Object obj)
Deprecated.
Return a content-based String representation if
obj is not null; otherwise returns an empty
String. |
static java.lang.String |
getIdentityHexString(java.lang.Object obj)
Deprecated.
Return a hex String form of an object's identity hash code.
|
static int |
hashCode(boolean bool)
Deprecated.
Return the same value as
Boolean.hashCode()}. |
static int |
hashCode(double dbl)
Deprecated.
Return the same value as
Double.hashCode()}. |
static int |
hashCode(float flt)
Deprecated.
Return the same value as
Float.hashCode()}. |
static int |
hashCode(long lng)
Deprecated.
Return the same value as
Long.hashCode()}. |
static java.lang.String |
identityToString(java.lang.Object obj)
Deprecated.
Return a String representation of an object's overall identity.
|
static boolean |
isArray(java.lang.Object obj)
Deprecated.
Determine whether the given object is an array: either an Object array or a primitive array.
|
static boolean |
isCheckedException(java.lang.Throwable ex)
Deprecated.
Return whether the given throwable is a checked exception: that is, neither a RuntimeException nor an Error.
|
static boolean |
isCompatibleWithThrowsClause(java.lang.Throwable ex,
java.lang.Class<?>... declaredExceptions)
Deprecated.
Check whether the given exception is compatible with the specified exception types, as declared in a throws
clause.
|
static boolean |
isEmpty(java.lang.Object obj)
Deprecated.
Determine whether the given object is empty.
|
static boolean |
isEmpty(java.lang.Object[] array)
Deprecated.
Determine whether the given array is empty: i.e.
|
static java.lang.String |
nullSafeClassName(java.lang.Object obj)
Deprecated.
Determine the class name for the given object.
|
static boolean |
nullSafeEquals(java.lang.Object o1,
java.lang.Object o2)
Deprecated.
Determine if the given objects are equal, returning
true if both are null or false if
only one is null. |
static int |
nullSafeHashCode(boolean[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(byte[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(char[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(double[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(float[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(int[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(long[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(java.lang.Object obj)
Deprecated.
Return as hash code for the given object; typically the value of
Object#hashCode()}. |
static int |
nullSafeHashCode(java.lang.Object[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(short[] array)
Deprecated.
Return a hash code based on the contents of the specified array.
|
static java.lang.String |
nullSafeToString(boolean[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(byte[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(char[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(double[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(float[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(int[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(long[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(java.lang.Object obj)
Deprecated.
Return a String representation of the specified Object.
|
static java.lang.String |
nullSafeToString(java.lang.Object[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.String |
nullSafeToString(short[] array)
Deprecated.
Return a String representation of the contents of the specified array.
|
static java.lang.Object[] |
toObjectArray(java.lang.Object source)
Deprecated.
Convert the given array (which may be a primitive array) to an object array (if necessary of primitive wrapper
objects).
|
public static boolean isCheckedException(java.lang.Throwable ex)
ex - the throwable to check.public static boolean isCompatibleWithThrowsClause(java.lang.Throwable ex,
java.lang.Class<?>... declaredExceptions)
ex - the exception to check.declaredExceptions - the exception types declared in the throws clause.public static boolean isArray(java.lang.Object obj)
obj - the object to check.public static boolean isEmpty(java.lang.Object[] array)
null or of zero length.array - the array to check.public static boolean isEmpty(java.lang.Object obj)
This method supports the following object types.
Array: considered empty if its length is zeroCharSequence: considered empty if its length is
zeroCollection: delegates to Collection.isEmpty()Map: delegates to
Map.isEmpty()If the given object is non-null and not one of the aforementioned supported
types, this method returns false.
obj - the object to check.true if the object is null or empty.public static boolean containsElement(java.lang.Object[] array,
java.lang.Object element)
array - the array to check (may be null, in which case the return value will always be false).element - the element to check for.public static boolean containsConstant(java.lang.Enum<?>[] enumValues,
java.lang.String constant)
enumValues - the enum values to check, typically the product of a call to MyEnum.values().constant - the constant name to find (must not be null or empty string).public static boolean containsConstant(java.lang.Enum<?>[] enumValues,
java.lang.String constant,
boolean caseSensitive)
enumValues - the enum values to check, typically the product of a call to MyEnum.values().constant - the constant name to find (must not be null or empty string).caseSensitive - whether case is significant in determining a match.public static <E extends java.lang.Enum<?>> E caseInsensitiveValueOf(E[] enumValues,
java.lang.String constant)
Enum.valueOf(Class, String).E - the concrete Enum type.enumValues - the array of all Enum constants in question, usually per Enum.values().constant - the constant to get the enum value of.java.lang.IllegalArgumentException - if the given constant is not found in the given array of enum values. Use
containsConstant(Enum[], String) as a guard to avoid this exception.public static <A,O extends A> A[] addObjectToArray(A[] array,
O obj)
array - the array to append to (can be null).obj - the object to append.null).public static java.lang.Object[] toObjectArray(java.lang.Object source)
A null source value will be converted to an empty Object array.
source - the (potentially primitive) array.null).java.lang.IllegalArgumentException - if the parameter is not an array.public static boolean nullSafeEquals(java.lang.Object o1,
java.lang.Object o2)
true if both are null or false if
only one is null. Compares arrays with Arrays.equals, performing an equality check based on
the array elements rather than the array reference.
o1 - first Object to compare.o2 - second Object to compare.Object.equals(Object),
Arrays.equals(long[], long[])public static int nullSafeHashCode(java.lang.Object obj)
Object#hashCode()}. If the object is an
array, this method will delegate to any of the nullSafeHashCode methods for arrays in this class. If the
object is null, this method returns 0.public static int nullSafeHashCode(java.lang.Object[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(boolean[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(byte[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(char[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(double[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(float[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(int[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(long[] array)
array is null, this method
returns 0.public static int nullSafeHashCode(short[] array)
array is null, this method
returns 0.public static int hashCode(boolean bool)
Boolean.hashCode()}.Boolean.hashCode()public static int hashCode(double dbl)
Double.hashCode()}.Double.hashCode()public static int hashCode(float flt)
Float.hashCode()}.Float.hashCode()public static int hashCode(long lng)
Long.hashCode()}.Long.hashCode()public static java.lang.String identityToString(java.lang.Object obj)
obj - the object (may be null).null.public static java.lang.String getIdentityHexString(java.lang.Object obj)
obj - the object.public static java.lang.String getDisplayString(java.lang.Object obj)
obj is not null; otherwise returns an empty
String.
Differs from nullSafeToString(Object) in that it returns an empty String rather than "null" for a
null value.
obj - the object to build a display String for.obj.nullSafeToString(Object)public static java.lang.String nullSafeClassName(java.lang.Object obj)
Returns "null" if obj is null.
obj - the object to introspect (may be null).public static java.lang.String nullSafeToString(java.lang.Object obj)
Builds a String representation of the contents in case of an array. Returns "null" if obj is
null.
obj - the object to build a String representation for.obj.public static java.lang.String nullSafeToString(java.lang.Object[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(boolean[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(byte[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(char[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(double[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(float[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(int[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(long[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.public static java.lang.String nullSafeToString(short[] array)
The String representation consists of a list of the array's elements, enclosed in curly braces ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Returns
"null" if array is null.
array - the array to build a String representation for.array.