org.apache.beehive.netui.compiler
Class AnnotationGrammar

Object
  extended by AnnotationGrammar
Direct Known Subclasses:
ActionOutputGrammar, BaseFlowControllerGrammar, BaseValidationRuleGrammar, SharedFlowRefGrammar, ValidatableBeanGrammar, ValidationMessageArgsGrammar, ValidationRulesContainerGrammar

public abstract class AnnotationGrammar
extends Object

Our base class for customizable annotation tag grammars. It has stock behavior for basic things like making sure required attributes exist, and provides plugin points for more complex checks.


Constructor Summary
protected AnnotationGrammar(AnnotationProcessorEnvironment env, Diagnostics diags, String requiredRuntimeVersion, RuntimeVersionChecker runtimeVersionChecker)
           
 
Method Summary
protected  void addError(AnnotationMirror element, String key, Object... args)
           
protected  void addError(AnnotationValue element, String key, Object... args)
           
protected  void addError(Declaration element, String key, Object... args)
           
protected  void addMemberArrayGrammar(String memberName, AnnotationGrammar grammar)
           
protected  void addMemberGrammar(String memberName, AnnotationGrammar grammar)
           
protected  void addMemberType(String memberName, AnnotationMemberType type)
           
protected  void addWarning(AnnotationMirror element, String key, Object... args)
           
protected  void addWarning(AnnotationValue element, String key, Object... args)
           
protected  void addWarning(Declaration element, String key, Object... args)
           
 boolean beginCheck(AnnotationMirror annotation, AnnotationMirror[] parentAnnotations, MemberDeclaration classMember)
           
 Object check(AnnotationMirror annotation, AnnotationMirror[] parentAnnotations, MemberDeclaration classMember)
           
 Object check(AnnotationMirror annotation, AnnotationMirror[] parentAnnotations, MemberDeclaration classMember, int annotationArrayIndex)
           
 Object endCheck(AnnotationMirror annotation, AnnotationMirror[] parentAnnotations, MemberDeclaration classMember, Set wasPresent, Map checkResults)
           
 String[][] getAttrDependencies()
          Each entry in this array (a String[]) is an array whose first element is an attribute that requires at least one of the subsequent elements to exist as an attribute.
 Diagnostics getDiagnostics()
           
 AnnotationProcessorEnvironment getEnv()
           
 String[][] getMutuallyExclusiveAttrs()
          Each entry in this array (a String[]) lists mutually exclusive attributes.
 String[][] getRequiredAttrs()
          Each entry in this array (a String[]) lists attributes of which one must exist in this tag.
 String getRequiredRuntimeVersion()
           
 RuntimeVersionChecker getRuntimeVersionChecker()
           
protected  boolean onBeginCheck(AnnotationMirror annotation, AnnotationMirror[] parentAnnotations, MemberDeclaration classMember)
           
protected  void onCheckMember(AnnotationTypeElementDeclaration memberDecl, AnnotationValue member, AnnotationMirror annotation, AnnotationMirror[] parentAnnotations, MemberDeclaration classMember)
           
protected  Object onEndCheck(AnnotationMirror annotation, AnnotationMirror[] parentAnnotations, MemberDeclaration classMember, Map checkResults)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationGrammar

protected AnnotationGrammar(AnnotationProcessorEnvironment env,
                            Diagnostics diags,
                            String requiredRuntimeVersion,
                            RuntimeVersionChecker runtimeVersionChecker)
Parameters:
requiredRuntimeVersion - causes an error to be produced if the version in the manifest of beehive-netui-pageflow.jar is not high enough.
Method Detail

getEnv

public AnnotationProcessorEnvironment getEnv()

getDiagnostics

public Diagnostics getDiagnostics()

check

public final Object check(AnnotationMirror annotation,
                          AnnotationMirror[] parentAnnotations,
                          MemberDeclaration classMember)

check

public final Object check(AnnotationMirror annotation,
                          AnnotationMirror[] parentAnnotations,
                          MemberDeclaration classMember,
                          int annotationArrayIndex)

beginCheck

public final boolean beginCheck(AnnotationMirror annotation,
                                AnnotationMirror[] parentAnnotations,
                                MemberDeclaration classMember)

addError

protected void addError(Declaration element,
                        String key,
                        Object... args)

addError

protected void addError(AnnotationValue element,
                        String key,
                        Object... args)

addError

protected void addError(AnnotationMirror element,
                        String key,
                        Object... args)

addWarning

protected void addWarning(Declaration element,
                          String key,
                          Object... args)

addWarning

protected void addWarning(AnnotationValue element,
                          String key,
                          Object... args)

addWarning

protected void addWarning(AnnotationMirror element,
                          String key,
                          Object... args)

endCheck

public final Object endCheck(AnnotationMirror annotation,
                             AnnotationMirror[] parentAnnotations,
                             MemberDeclaration classMember,
                             Set wasPresent,
                             Map checkResults)
Returns:
a result (any Object) that will be passed back to the parent checker. May be null.

onBeginCheck

protected boolean onBeginCheck(AnnotationMirror annotation,
                               AnnotationMirror[] parentAnnotations,
                               MemberDeclaration classMember)

onEndCheck

protected Object onEndCheck(AnnotationMirror annotation,
                            AnnotationMirror[] parentAnnotations,
                            MemberDeclaration classMember,
                            Map checkResults)
Parameters:
checkResults - map of member-name (String) -> result-from-checking (Object)
Returns:
a result (any Object) that will be passed back to the parent checker. May be null.

onCheckMember

protected void onCheckMember(AnnotationTypeElementDeclaration memberDecl,
                             AnnotationValue member,
                             AnnotationMirror annotation,
                             AnnotationMirror[] parentAnnotations,
                             MemberDeclaration classMember)

getMutuallyExclusiveAttrs

public String[][] getMutuallyExclusiveAttrs()
Each entry in this array (a String[]) lists mutually exclusive attributes.


getRequiredAttrs

public String[][] getRequiredAttrs()
Each entry in this array (a String[]) lists attributes of which one must exist in this tag.


getAttrDependencies

public String[][] getAttrDependencies()
Each entry in this array (a String[]) is an array whose first element is an attribute that requires at least one of the subsequent elements to exist as an attribute.


addMemberGrammar

protected void addMemberGrammar(String memberName,
                                AnnotationGrammar grammar)

addMemberArrayGrammar

protected void addMemberArrayGrammar(String memberName,
                                     AnnotationGrammar grammar)

addMemberType

protected void addMemberType(String memberName,
                             AnnotationMemberType type)

getRequiredRuntimeVersion

public String getRequiredRuntimeVersion()

getRuntimeVersionChecker

public RuntimeVersionChecker getRuntimeVersionChecker()