Package org.apache.ibatis.reflection
Class ArrayUtil
- java.lang.Object
-
- org.apache.ibatis.reflection.ArrayUtil
-
public class ArrayUtil extends java.lang.Object
Provides hashCode, equals and toString methods that can handle array.
-
-
Constructor Summary
Constructors Constructor Description ArrayUtil()
-
Method Summary
Modifier and Type Method Description static boolean
equals(java.lang.Object thisObj, java.lang.Object thatObj)
Compares two objects.static int
hashCode(java.lang.Object obj)
Returns a hash code forobj
.static java.lang.String
toString(java.lang.Object obj)
If theobj
is an array, toString() method ofArrays
is called.
-
-
-
Method Detail
-
hashCode
public static int hashCode(java.lang.Object obj)
Returns a hash code forobj
.- Parameters:
obj
- The object to get a hash code for. May be an array ornull
.- Returns:
- A hash code of
obj
or 0 ifobj
isnull
-
equals
public static boolean equals(java.lang.Object thisObj, java.lang.Object thatObj)
Compares two objects. Returnstrue
ifthisObj
andthatObj
are bothnull
thisObj
andthatObj
are instances of the same type andObject.equals(Object)
returnstrue
thisObj
andthatObj
are arrays with the same component type and equals() method ofArrays
returnstrue
(not deepEquals())
- Parameters:
thisObj
- The left hand object to compare. May be an array ornull
thatObj
- The right hand object to compare. May be an array ornull
- Returns:
true
if two objects are equal;false
otherwise.
-
toString
public static java.lang.String toString(java.lang.Object obj)
If theobj
is an array, toString() method ofArrays
is called. OtherwiseObject.toString()
is called. Returns "null" ifobj
isnull
.- Parameters:
obj
- An object. May be an array ornull
.- Returns:
- String representation of the
obj
.
-
-