1 9 package org.jboss.portal.server.plugins; 10 11 import org.jboss.portal.server.kernel.ServiceID; 12 13 19 public class PluginID 20 implements ServiceID 21 { 22 23 private ServiceID containerID; 24 private String name; 25 26 public PluginID(ServiceID containerID, String name) 27 { 28 if (containerID == null) 29 { 30 throw new IllegalArgumentException ("No null container ID"); 31 } 32 if (name == null) 33 { 34 throw new IllegalArgumentException ("No null name"); 35 } 36 this.containerID = containerID; 37 this.name = name; 38 } 39 40 public int hashCode() 41 { 42 return name.hashCode() & containerID.hashCode(); 43 } 44 45 public boolean equals(Object obj) 46 { 47 if (obj == this) 48 { 49 return true; 50 } 51 if (obj instanceof PluginID) 52 { 53 PluginID other = (PluginID)obj; 54 return name.equals(other.name) && containerID.equals(other.containerID); 55 } 56 return false; 57 } 58 59 public ServiceID getContainerID() 60 { 61 return containerID; 62 } 63 64 public String getName() 65 { 66 return name; 67 } 68 69 public String toString() 70 { 71 return "(" + containerID + "-" + name + ")"; 72 } 73 } 74 | Popular Tags |