1 29 30 package com.caucho.bytecode; 31 32 import java.util.Map ; 33 34 37 abstract public class JAnnotation { 38 41 abstract public String getType(); 42 43 46 abstract public Map <String ,Object > getValueMap(); 47 48 51 public Object get(String name) 52 { 53 return getValueMap().get(name); 54 } 55 56 59 public String getString(String name) 60 { 61 return (String ) get(name); 62 } 63 64 67 public JClass getClass(String name) 68 { 69 return (JClass) get(name); 70 } 71 72 75 public int getInt(String name) 76 { 77 Integer value = (Integer ) get(name); 78 79 if (value != null) 80 return value.intValue(); 81 else 82 return 0; 83 } 84 85 88 public boolean getBoolean(String name) 89 { 90 return Boolean.TRUE.equals(get(name)); 91 } 92 93 96 public JAnnotation getAnnotation(String name) 97 { 98 return (JAnnotation) get(name); 99 } 100 101 104 public boolean equals(Object o) 105 { 106 if (o == this) 107 return true; 108 else if (o == null || getClass() != o.getClass()) 109 return false; 110 111 JAnnotation jAnnotation = (JAnnotation) o; 112 113 return getType().equals(jAnnotation.getType()); 115 } 116 117 public String toString() 118 { 119 return "JAnnotation[" + getType() + "]"; 120 } 121 } 122 | Popular Tags |