1 9 package org.jboss.portal.test.portal.kernel; 10 11 import org.jboss.portal.server.kernel.ServiceID; 12 13 17 public class ServiceIDImpl implements ServiceID 18 { 19 private final String name; 20 21 public ServiceIDImpl(String name) 22 { 23 if (name == null) 24 { 25 throw new IllegalArgumentException ("name must not be null"); 26 } 27 this.name = name; 28 } 29 30 public int hashCode() 31 { 32 return name.hashCode(); 33 } 34 35 public boolean equals(Object obj) 36 { 37 if (obj == this) 38 { 39 return true; 40 } 41 if (obj instanceof ServiceIDImpl) 42 { 43 return ((ServiceIDImpl)obj).name.equals(name); 44 } 45 return false; 46 } 47 48 public String toString() 49 { 50 return "ServiceID : " + name; 51 } 52 } 53 | Popular Tags |