1 22 package org.jboss.metadata.spi.retrieval.simple; 23 24 import org.jboss.metadata.spi.retrieval.MetaDataItem; 25 26 33 public class SimpleMetaDataItem<T> extends SimpleItem<T> implements MetaDataItem<T> 34 { 35 36 private T metaData; 37 38 39 private String name; 40 41 47 public SimpleMetaDataItem(String name, T metaData) 48 { 49 if (name == null) 50 throw new IllegalArgumentException ("Null name"); 51 52 this.name = name; 53 this.metaData = metaData; 54 } 55 56 public T getValue() 57 { 58 return metaData; 59 } 60 61 public String getName() 62 { 63 return name; 64 } 65 66 public boolean equals(Object object) 67 { 68 if (object == this) 69 return true; 70 if (object == null || object instanceof MetaDataItem == false) 71 return false; 72 73 MetaDataItem other = (MetaDataItem) object; 74 return getName().equals(other.getName()); 75 } 76 77 public int hashCode() 78 { 79 return getName().hashCode(); 80 } 81 82 public String toString() 83 { 84 return getValue().toString(); 85 } 86 } 87 | Popular Tags |