javax.management

Class ObjectInstance

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 {@link DynamicMBean}, the class name may be obtained using {@link MBeanInfo#getClassName()}.

Since: 1.5

Constructor Summary
ObjectInstance(ObjectName name, String className)
Constructs a new {@link ObjectInstance} for the specified bean with the supplied class name.
ObjectInstance(String name, String className)
Constructs a new {@link ObjectInstance} for the specified bean with the supplied class name.
Method Summary
booleanequals(Object obj)
Returns true if the supplied object is also an {@link ObjectInstance} with the same bean and class name.
StringgetClassName()
Returns the class name of the bean.
ObjectNamegetObjectName()
Returns the name of the bean.
inthashCode()
Returns a hash code for this instance.

Constructor Detail

ObjectInstance

public ObjectInstance(ObjectName name, String className)
Constructs a new {@link 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)
Constructs a new {@link 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 {@link ObjectName}.

Method Detail

equals

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

Parameters: obj the object to compare.

Returns: true if the the supplied object is equal to this.

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.

Returns: the hash code of this instance.