Class StandardAnnotation

java.lang.Object
org.aspectj.weaver.AbstractAnnotationAJ
org.aspectj.weaver.StandardAnnotation
All Implemented Interfaces:
AnnotationAJ

public class StandardAnnotation extends AbstractAnnotationAJ
This type represents the weavers abstraction of an annotation - it is not tied to any underlying BCI toolkit. The weaver actualy handles these through AnnotationX wrapper objects - until we start transforming the BCEL annotations into this form (expensive) or offer a clever visitor mechanism over the BCEL annotation stuff that builds these annotation types directly.
Author:
AndyClement
  • Constructor Details

    • StandardAnnotation

      public StandardAnnotation(ResolvedType type, boolean isRuntimeVisible)
  • Method Details

    • isRuntimeVisible

      public boolean isRuntimeVisible()
      Specified by:
      isRuntimeVisible in interface AnnotationAJ
      Specified by:
      isRuntimeVisible in class AbstractAnnotationAJ
      Returns:
      true if the annotation is marked for runtime visibility
    • stringify

      public String stringify()
      Specified by:
      stringify in interface AnnotationAJ
      Specified by:
      stringify in class AbstractAnnotationAJ
      Returns:
      String form of the annotation and any values, eg. @Foo(a=b,c=d)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hasNamedValue

      public boolean hasNamedValue(String n)
      Specified by:
      hasNamedValue in interface AnnotationAJ
      Specified by:
      hasNamedValue in class AbstractAnnotationAJ
      Parameters:
      n - the name of the value
      Returns:
      true if there is a value with that name
    • hasNameValuePair

      public boolean hasNameValuePair(String n, String v)
      Specified by:
      hasNameValuePair in interface AnnotationAJ
      Specified by:
      hasNameValuePair in class AbstractAnnotationAJ
      Parameters:
      n - the name of the annotation field
      v - the value of the annotation field
      Returns:
      true if there is a value with the specified name and value
    • getTargets

      public Set<String> getTargets()
      Specified by:
      getTargets in interface AnnotationAJ
      Specified by:
      getTargets in class AbstractAnnotationAJ
      Returns:
      for the @target annotation, this will return a set of the element-types it can be applied to. For other annotations , it returns the empty set.
    • getNameValuePairs

      public List<AnnotationNameValuePair> getNameValuePairs()
    • hasNameValuePairs

      public boolean hasNameValuePairs()
    • addNameValuePair

      public void addNameValuePair(AnnotationNameValuePair pair)
    • getStringFormOfValue

      public String getStringFormOfValue(String name)
      Determine the string representation of the value of a field. For example in @SuppressAjWarnings({"adviceDidNotMatch"}) the return value for getStringFormOfValue("value") would be "[adviceDidNotMatch]".
      Parameters:
      name - the name of the annotation field being looked up
      Returns:
      string representation of the value of that field, may be null if no such field set