1 7 8 package javax.management; 9 10 11 import java.io.Serializable ; 13 14 15 21 public class Attribute implements Serializable { 22 23 24 private static final long serialVersionUID = 2484220110589082382L; 25 26 29 private String name; 30 31 34 private Object value= null; 35 36 37 44 public Attribute(String name, Object value) { 45 46 if (name == null) { 47 throw new RuntimeOperationsException (new IllegalArgumentException ("Attribute name cannot be null ")); 48 } 49 50 this.name = name; 51 this.value = value; 52 } 53 54 55 60 public String getName() { 61 return name; 62 } 63 64 69 public Object getValue() { 70 return value; 71 } 72 73 80 81 82 public boolean equals(Object object) { 83 if (!(object instanceof Attribute )) { 84 return false; 85 } 86 Attribute val = (Attribute ) object; 87 88 if (value == null) { 89 if (val.getValue() == null) { 90 return name.equals(val.getName()); 91 } else { 92 return false; 93 } 94 } 95 96 return ((name.equals(val.getName())) && 97 (value.equals(val.getValue()))); 98 } 99 100 } 101 | Popular Tags |