1 19 20 package org.netbeans.modules.junit; 21 22 25 public final class NamedObject { 26 27 28 public String name; 29 30 public Object object; 31 32 38 public NamedObject(Object object, String name) { 39 if ((object == null) || (name == null)) { 40 throw new IllegalArgumentException ("null"); } 42 this.object = object; 43 this.name = name; 44 } 45 46 51 public String toString() { 52 return name; 53 } 54 55 57 public boolean equals(Object o) { 58 if (o == this) { 59 return true; 60 } 61 if (o == null) { 62 return false; 63 } 64 if (!o.getClass().equals(NamedObject.class)) { 65 return false; 66 } 67 final NamedObject otherNamed = (NamedObject) o; 68 return name.equals(otherNamed.name) 69 && object.equals(otherNamed.object); 70 } 71 72 74 public int hashCode() { 75 return name.hashCode() + object.hashCode(); 76 } 77 78 } 79 | Popular Tags |