1 22 package org.jboss.metadata.spi.retrieval.helper; 23 24 import java.lang.annotation.Annotation ; 25 26 import org.jboss.metadata.spi.retrieval.AnnotationItem; 27 import org.jboss.metadata.spi.retrieval.MetaDataItem; 28 29 36 public class MetaDataToAnnotationBridge<T extends Annotation > implements AnnotationItem<T> 37 { 38 39 private MetaDataItem metaData; 40 41 46 public MetaDataToAnnotationBridge(MetaDataItem metaData) 47 { 48 if (metaData == null) 49 throw new IllegalArgumentException ("Null metaData"); 50 this.metaData = metaData; 51 } 52 53 public boolean isCachable() 54 { 55 return metaData.isCachable(); 56 } 57 58 public boolean isValid() 59 { 60 return metaData.isValid(); 61 } 62 63 @SuppressWarnings ("unchecked") 64 public T getValue() 65 { 66 return (T) metaData.getValue(); 67 } 68 69 public T getAnnotation() 70 { 71 return getValue(); 72 } 73 74 public String getName() 75 { 76 return getValue().annotationType().getName(); 77 } 78 } 79 | Popular Tags |