1 package org.apache.beehive.controls.runtime.generator; 2 3 20 21 import java.util.HashMap ; 22 import java.util.Map ; 23 24 import com.sun.mirror.declaration.AnnotationMirror; 25 import com.sun.mirror.declaration.AnnotationTypeElementDeclaration; 26 import com.sun.mirror.declaration.AnnotationValue; 27 28 32 public class AptAnnotationHelper 33 { 34 38 public AptAnnotationHelper(AnnotationMirror annot) 39 { 40 Map <AnnotationTypeElementDeclaration,AnnotationValue> elemValues = 44 annot.getElementValues(); 45 46 for (AnnotationTypeElementDeclaration ated : elemValues.keySet()) 47 { 48 _elementMap.put(ated.getSimpleName(), ated); 49 _valueMap.put(ated.getSimpleName(), elemValues.get(ated)); 50 } 51 }; 52 53 56 public AnnotationTypeElementDeclaration getElementDeclaration(String elemName) 57 { 58 if (_elementMap.containsKey(elemName)) 59 return _elementMap.get(elemName); 60 return null; 61 } 62 63 66 public String getStringValue(String elemName) 67 { 68 if (_valueMap.containsKey(elemName)) 69 return _valueMap.get(elemName).toString(); 70 return null; 71 } 72 73 76 public Object getObjectValue(String elemName) 77 { 78 if (_valueMap.containsKey(elemName)) 79 return _valueMap.get(elemName).getValue(); 80 return null; 81 } 82 83 private HashMap <String ,AnnotationTypeElementDeclaration> _elementMap = 84 new HashMap <String ,AnnotationTypeElementDeclaration>(); 85 private HashMap <String ,AnnotationValue> _valueMap = 86 new HashMap <String ,AnnotationValue>(); 87 } 88 | Popular Tags |