1 18 package org.apache.beehive.netui.compiler; 19 20 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; 21 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration; 22 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue; 23 import org.apache.beehive.netui.compiler.typesystem.declaration.Declaration; 24 import org.apache.beehive.netui.compiler.typesystem.declaration.MemberDeclaration; 25 import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment; 26 27 28 public class AnnotationMemberType 29 implements JpfLanguageConstants 30 { 31 32 private String _requiredRuntimeVersion = null; 33 private AnnotationGrammar _parentGrammar; 34 private AnnotationMemberType _nextInChain; 35 36 37 public AnnotationMemberType( String requiredRuntimeVersion, AnnotationGrammar parentGrammar ) 38 { 39 _requiredRuntimeVersion = requiredRuntimeVersion; 40 _parentGrammar = parentGrammar; 41 } 42 43 public AnnotationMemberType( String requiredRuntimeVersion, AnnotationGrammar parentGrammar, 44 AnnotationMemberType nextInChain ) 45 { 46 this( requiredRuntimeVersion, parentGrammar ); 47 _nextInChain = nextInChain; 48 } 49 50 53 public final Object check( AnnotationTypeElementDeclaration valueDecl, AnnotationValue value, 54 AnnotationInstance[] parentAnnotations, MemberDeclaration classMember, 55 int annotationArrayIndex ) 56 throws FatalCompileTimeException 57 { 58 String valueName = valueDecl.getSimpleName(); 62 Diagnostics diags = _parentGrammar.getDiagnostics(); 63 _parentGrammar.getRuntimeVersionChecker().checkRuntimeVersion( 64 _requiredRuntimeVersion, value, diags, "error.required-runtime-version-attribute", 65 new Object []{ valueName, PAGEFLOW_RUNTIME_JAR } ); 66 67 Object retVal = onCheck( valueDecl, value, parentAnnotations, classMember, annotationArrayIndex ); 69 if ( _nextInChain != null ) 70 { 71 return _nextInChain.check( valueDecl, value, parentAnnotations, classMember, annotationArrayIndex ); 72 } 73 return retVal; 74 } 75 76 79 public Object onCheck( AnnotationTypeElementDeclaration valueDecl, AnnotationValue member, 80 AnnotationInstance[] parentAnnotations, MemberDeclaration classMember, 81 int annotationArrayIndex ) 82 throws FatalCompileTimeException 83 { 84 return null; 85 } 86 87 protected void addError( Declaration element, String key ) 88 { 89 _parentGrammar.addError( element, key, null ); 90 } 91 92 protected void addError( Declaration element, String key, Object [] args ) 93 { 94 _parentGrammar.addError( element, key, args ); 95 } 96 97 protected void addError( Declaration element, String key, Object arg ) 98 { 99 _parentGrammar.addError( element, key, new Object []{ arg } ); 100 } 101 102 protected void addError( Declaration element, String key, Object arg1, Object arg2 ) 103 { 104 _parentGrammar.addError( element, key, new Object []{ arg1, arg2 } ); 105 } 106 107 protected void addError( Declaration element, String key, Object arg1, Object arg2, Object arg3 ) 108 { 109 _parentGrammar.addError( element, key, new Object []{ arg1, arg2, arg3 } ); 110 } 111 112 protected void addError( AnnotationValue element, String key ) 113 { 114 _parentGrammar.addError( element, key, null ); 115 } 116 117 protected void addError( AnnotationValue element, String key, Object [] args ) 118 { 119 _parentGrammar.addError( element, key, args ); 120 } 121 122 protected void addError( AnnotationValue element, String key, Object arg1 ) 123 { 124 _parentGrammar.addError( element, key, new Object []{ arg1 } ); 125 } 126 127 protected void addError( AnnotationValue element, String key, Object arg1, Object arg2 ) 128 { 129 _parentGrammar.addError( element, key, new Object []{ arg1, arg2 } ); 130 } 131 132 protected void addError( AnnotationValue element, String key, Object arg1, Object arg2, Object arg3 ) 133 { 134 _parentGrammar.addError( element, key, new Object []{ arg1, arg2, arg3 } ); 135 } 136 137 protected void addError( AnnotationInstance element, String key ) 138 { 139 _parentGrammar.addError( element, key, null ); 140 } 141 142 protected void addError( AnnotationInstance element, String key, Object [] args ) 143 { 144 _parentGrammar.addError( element, key, args ); 145 } 146 147 protected void addError( AnnotationInstance element, String key, Object arg1 ) 148 { 149 _parentGrammar.addError( element, key, new Object []{ arg1 } ); 150 } 151 152 protected void addError( AnnotationInstance element, String key, Object arg1, Object arg2 ) 153 { 154 _parentGrammar.addError( element, key, new Object []{ arg1, arg2 } ); 155 } 156 157 protected void addError( AnnotationInstance element, String key, Object arg1, Object arg2, Object arg3 ) 158 { 159 _parentGrammar.addError( element, key, new Object []{ arg1, arg2, arg3 } ); 160 } 161 162 protected void addWarning( Declaration element, String key ) 163 { 164 _parentGrammar.addWarning( element, key, null ); 165 } 166 167 protected void addWarning( Declaration element, String key, Object [] args ) 168 { 169 _parentGrammar.addWarning( element, key, args ); 170 } 171 172 protected void addWarning( Declaration element, String key, Object arg ) 173 { 174 _parentGrammar.addWarning( element, key, new Object []{ arg } ); 175 } 176 177 protected void addWarning( Declaration element, String key, Object arg1, Object arg2 ) 178 { 179 _parentGrammar.addWarning( element, key, new Object []{ arg1, arg2 } ); 180 } 181 182 protected void addWarning( Declaration element, String key, Object arg1, Object arg2, Object arg3 ) 183 { 184 _parentGrammar.addWarning( element, key, new Object []{ arg1, arg2, arg3 } ); 185 } 186 187 protected void addWarning( AnnotationValue element, String key ) 188 { 189 _parentGrammar.addWarning( element, key, null ); 190 } 191 192 protected void addWarning( AnnotationValue element, String key, Object [] args ) 193 { 194 _parentGrammar.addWarning( element, key, args ); 195 } 196 197 protected void addWarning( AnnotationValue element, String key, Object arg1 ) 198 { 199 _parentGrammar.addWarning( element, key, new Object []{ arg1 } ); 200 } 201 202 protected void addWarning( AnnotationValue element, String key, Object arg1, Object arg2 ) 203 { 204 _parentGrammar.addWarning( element, key, new Object []{ arg1, arg2 } ); 205 } 206 207 protected void addWarning( AnnotationValue element, String key, Object arg1, Object arg2, Object arg3 ) 208 { 209 _parentGrammar.addWarning( element, key, new Object []{ arg1, arg2, arg3 } ); 210 } 211 212 protected void addWarning( AnnotationInstance element, String key ) 213 { 214 _parentGrammar.addWarning( element, key, null ); 215 } 216 217 protected void addWarning( AnnotationInstance element, String key, Object [] args ) 218 { 219 _parentGrammar.addWarning( element, key, args ); 220 } 221 222 protected void addWarning( AnnotationInstance element, String key, Object arg1 ) 223 { 224 _parentGrammar.addWarning( element, key, new Object []{ arg1 } ); 225 } 226 227 protected void addWarning( AnnotationInstance element, String key, Object arg1, Object arg2 ) 228 { 229 _parentGrammar.addWarning( element, key, new Object []{ arg1, arg2 } ); 230 } 231 232 protected void addWarning( AnnotationInstance element, String key, Object arg1, Object arg2, Object arg3 ) 233 { 234 _parentGrammar.addWarning( element, key, new Object []{ arg1, arg2, arg3 } ); 235 } 236 237 protected AnnotationGrammar getParentGrammar() 238 { 239 return _parentGrammar; 240 } 241 242 protected final AnnotationProcessorEnvironment getEnv() 243 { 244 return _parentGrammar.getEnv(); 245 } 246 247 protected final Diagnostics getDiagnostics() 248 { 249 return _parentGrammar.getDiagnostics(); 250 } 251 } 252 | Popular Tags |