javax.management
Class ObjectInstance

java.lang.Object
  extended by javax.management.ObjectInstance
All Implemented Interfaces:
Serializable

public class ObjectInstance
extends Object
implements Serializable

A simple class used to link a bean instance to its class name. If the bean is a DynamicMBean, the class name may be obtained using MBeanInfo.getClassName().

Since:
1.5
See Also:
Serialized Form

Constructor Summary
ObjectInstance(ObjectName name, String className)
          Constructs a new ObjectInstance for the specified bean with the supplied class name.
ObjectInstance(String name, String className)
          Constructs a new ObjectInstance for the specified bean with the supplied class name.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the supplied object is also an ObjectInstance with the same bean and class name.
 String getClassName()
          Returns the class name of the bean.
 ObjectName getObjectName()
          Returns the name of the bean.
 int hashCode()
          Returns a hash code for this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectInstance

public ObjectInstance(ObjectName name,
                      String className)
Constructs a new ObjectInstance for the specified bean with the supplied class name. The class name should include the full package name.

Parameters:
name - the name of the bean.
className - the class name of the bean.

ObjectInstance

public ObjectInstance(String name,
                      String className)
               throws MalformedObjectNameException
Constructs a new ObjectInstance for the specified bean with the supplied class name. The class name should include the full package name.

Parameters:
name - the name of the bean.
className - the class name of the bean.
Throws:
MalformedObjectNameException - if the name of the bean does not match the syntax of an ObjectName.
Method Detail

equals

public boolean equals(Object obj)
Returns true if the supplied object is also an ObjectInstance with the same bean and class name.

Overrides:
equals in class Object
Parameters:
obj - the object to compare.
Returns:
true if the the supplied object is equal to this.
See Also:
Object.hashCode()

getClassName

public String getClassName()
Returns the class name of the bean.

Returns:
the class name.

getObjectName

public ObjectName getObjectName()
Returns the name of the bean.

Returns:
the name of the bean.

hashCode

public int hashCode()
Returns a hash code for this instance. This is calculated as the sum of the hashcodes for the bean's name and the class name.

Overrides:
hashCode in class Object
Returns:
the hash code of this instance.
See Also:
Object.equals(Object), System.identityHashCode(Object)