home *** CD-ROM | disk | FTP | other *** search
- package javax.management;
-
- import java.io.Serializable;
-
- public class ObjectInstance implements Serializable {
- private static final long serialVersionUID = -4099952623687795850L;
- private String className;
- private ObjectName name;
-
- public ObjectInstance(String objectName, String className) throws MalformedObjectNameException {
- this(new ObjectName(objectName), className);
- }
-
- public ObjectInstance(ObjectName objectName, String className) {
- if (objectName != null && !objectName.isPattern()) {
- if (className != null && className.trim().length() != 0) {
- this.name = objectName;
- this.className = className;
- } else {
- throw new RuntimeOperationsException(new IllegalArgumentException("Class name cannot be null or empty"));
- }
- } else {
- throw new RuntimeOperationsException(new IllegalArgumentException("Invalid object name"));
- }
- }
-
- public boolean equals(Object object) {
- if (object == null) {
- return false;
- } else if (object == this) {
- return true;
- } else {
- try {
- ObjectInstance other = (ObjectInstance)object;
- return this.name.equals(other.name) && this.className.equals(other.className);
- } catch (ClassCastException var3) {
- return false;
- }
- }
- }
-
- public int hashCode() {
- return this.name.hashCode() ^ this.className.hashCode();
- }
-
- public ObjectName getObjectName() {
- return this.name;
- }
-
- public String getClassName() {
- return this.className;
- }
-
- public String toString() {
- return this.getClassName() + "@" + this.getObjectName();
- }
- }
-