1 18 package org.apache.beehive.netui.compiler.grammar; 19 20 import org.apache.beehive.netui.compiler.AnnotationMemberType; 21 import org.apache.beehive.netui.compiler.AnnotationGrammar; 22 import org.apache.beehive.netui.compiler.CompilerUtils; 23 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationTypeElementDeclaration; 24 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationValue; 25 import org.apache.beehive.netui.compiler.typesystem.declaration.AnnotationInstance; 26 import org.apache.beehive.netui.compiler.typesystem.declaration.MemberDeclaration; 27 28 29 32 public class RolesAllowedType 33 extends AnnotationMemberType 34 { 35 public RolesAllowedType( AnnotationGrammar parentGrammar ) 36 { 37 super( null, parentGrammar ); 38 } 39 40 41 public Object onCheck( AnnotationTypeElementDeclaration valueDecl, AnnotationValue member, 42 AnnotationInstance[] parentAnnotations, MemberDeclaration classMember, 43 int annotationArrayIndex ) 44 { 45 AnnotationInstance parentAnnotation = parentAnnotations[ parentAnnotations.length - 1 ]; 46 Boolean loginRequired = CompilerUtils.getBoolean( parentAnnotation, LOGIN_REQUIRED_ATTR, true ); 47 48 if ( loginRequired != null && ! loginRequired.booleanValue() ) 49 { 50 addError( member, "error.roles-with-no-login-required" ); 51 } 52 53 return null; 54 } 55 } 56 | Popular Tags |