com.adventnet.utils.jmx
Class ObjectArrayWrapper

java.lang.Object
  |
  +--com.adventnet.utils.jmx.ObjectArrayWrapper

public class ObjectArrayWrapper
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

This class is useful in picking up an object from the Hashtable where the key is an Object[]. Thus instead of putting Object[] as key just make ObjectArray class instance for that Object[] and use this as key so that different objects inside the Object[] with the same hashCodes when queried to Hashtable get its value object. This class overrides the equals(), hashCode() methods in java.lang.Object and implements the compareTo method from Comparable interface. Used in javax.management.TabularData class.

See Also:
Serialized Form

Constructor Summary
ObjectArrayWrapper(java.lang.Object[] array)
          Constructor which takes the ObjectArray as the parameter.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares the local Object[] with the specified Object o, comparing each element lexicographically.
 boolean equals(java.lang.Object object)
          Returns true if each element in this array is equal to each array in object passed, determined by the equals method of each element.
(package private)  java.lang.Object[] getObjectArray()
          Returns the Object[] reference.
 int hashCode()
          Returns the hashCode specific to this ObjectArray.
 java.lang.Object[] toArray()
          Returns the Object[] reference.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectArrayWrapper

public ObjectArrayWrapper(java.lang.Object[] array)
Constructor which takes the ObjectArray as the parameter. This will keep a copy of the array passed.
Method Detail

equals

public boolean equals(java.lang.Object object)
Returns true if each element in this array is equal to each array in object passed, determined by the equals method of each element.
Overrides:
equals in class java.lang.Object
Returns:
true if the object passed is equal to this object.

hashCode

public int hashCode()
Returns the hashCode specific to this ObjectArray. This uses a calulation to return the hashCode from each elements hashCode. This method is overridden to return the same hashCode for different references of ObjectArray but with the same values.
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Compares the local Object[] with the specified Object o, comparing each element lexicographically.
Specified by:
compareTo in interface java.lang.Comparable

getObjectArray

java.lang.Object[] getObjectArray()
Returns the Object[] reference.

toArray

public java.lang.Object[] toArray()
Returns the Object[] reference.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object