Top Description Fields Constructors Methods
org.apache.avro.util.springframework

pack-priv Class ObjectUtils

extends Object
Class Inheritance
Imports
org.apache.avro.reflect.Nullable, org.apache.avro.util.ClassUtils, java.util.Arrays

Miscellaneous object utility methods.

Mainly for internal use within the framework.

Thanks to Alex Ruiz for contributing several enhancements to this class!

Authors
Juergen Hoeller, Keith Donald, Rod Johnson, Rob Harrop, Chris Beams, Sam Brannen
Since
19.03.2004
See Also
see CollectionUtils see StringUtils

Field Summary

Modifier and TypeField and Description
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

whether the given objects are equal
arrayEquals
(Object
first array to compare
o1
,
Object
second array to compare
o2
)

Compare the given arrays with Arrays.equals, performing an equality check based on the array elements rather than the array reference.

public static boolean
isEmpty(Object[]
the array to check
array
)

Determine whether the given array is empty: i.e. null or of zero length.

public static boolean

Returns:

whether the given objects are equal
nullSafeEquals
(Object
first Object to compare
o1
,
Object
second Object to compare
o2
)

Determine if the given objects are equal, returning true if both are null or false if only one is null.

public static int
nullSafeHashCode(Object obj)

Return as hash code for the given object; typically the value of Object#hashCode()}.

public static int
nullSafeHashCode(Object[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(boolean[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(byte[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(char[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(double[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(float[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(int[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(long[] array)

Return a hash code based on the contents of the specified array.

public static int
nullSafeHashCode(short[] array)

Return a hash code based on the contents of the specified array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INITIAL_HASHback to summary
private static final int INITIAL_HASH
MULTIPLIERback to summary
private static final int MULTIPLIER

Constructor Detail

ObjectUtilsback to summary
private ObjectUtils()

Method Detail

arrayEqualsback to summary
private static boolean arrayEquals(Object o1, Object o2)

Compare the given arrays with Arrays.equals, performing an equality check based on the array elements rather than the array reference.

Parameters
o1:Object

first array to compare

o2:Object

second array to compare

Returns:boolean

whether the given objects are equal

See Also
nullSafeEquals(Object, Object), Arrays#equals
isEmptyback to summary
public static boolean isEmpty(Object[] array)

Determine whether the given array is empty: i.e. null or of zero length.

Parameters
array:Object[]

the array to check

nullSafeEqualsback to summary
public static boolean nullSafeEquals(Object o1, Object o2)

Determine if the given objects are equal, returning 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.

Parameters
o1:Object

first Object to compare

o2:Object

second Object to compare

Returns:boolean

whether the given objects are equal

See Also
Object#equals(Object), Arrays#equals
nullSafeHashCodeback to summary
public static int nullSafeHashCode(Object obj)

Return as hash code for the given object; typically the value of 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.

See Also
Object#hashCode(), nullSafeHashCode(Object[]), nullSafeHashCode(boolean[]), nullSafeHashCode(byte[]), nullSafeHashCode(char[]), nullSafeHashCode(double[]), nullSafeHashCode(float[]), nullSafeHashCode(int[]), nullSafeHashCode(long[]), nullSafeHashCode(short[])
nullSafeHashCodeback to summary
public static int nullSafeHashCode(Object[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(boolean[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(byte[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(char[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(double[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(float[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(int[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(long[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.

nullSafeHashCodeback to summary
public static int nullSafeHashCode(short[] array)

Return a hash code based on the contents of the specified array. If array is null, this method returns 0.