1 7 8 package com.sun.jmx.mbeanserver; 9 10 import javax.management.* ; 11 12 13 14 21 public class NamedObject { 22 23 24 27 private ObjectName name; 28 29 32 private Object object= null; 33 34 35 41 public NamedObject(ObjectName objectName, Object object) { 42 if (objectName.isPattern()) { 43 throw new RuntimeOperationsException(new IllegalArgumentException ("Invalid name->"+ objectName.toString())); 44 } 45 this.name= objectName; 46 this.object= object; 47 } 48 49 57 public NamedObject(String objectName, Object object) throws MalformedObjectNameException{ 58 ObjectName objName= new ObjectName(objectName); 59 if (objName.isPattern()) { 60 throw new RuntimeOperationsException(new IllegalArgumentException ("Invalid name->"+ objName.toString())); 61 } 62 this.name= objName; 63 this.object= object; 64 } 65 66 74 public boolean equals(Object object) { 75 if (this == object) return true; 76 if (object == null) return false; 77 if (!(object instanceof NamedObject)) return false; 78 NamedObject no = (NamedObject) object; 79 return name.equals(no.getName()); 80 } 81 82 83 87 public int hashCode() { 88 return name.hashCode(); 89 } 90 91 94 public ObjectName getName() { 95 return name; 96 } 97 98 101 public Object getObject() { 102 return object; 103 } 104 105 } 106 | Popular Tags |