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