Class BcelAnnotation

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

public class BcelAnnotation extends AbstractAnnotationAJ
Wraps a Bcel Annotation object and uses it to answer AnnotationAJ method calls. This is cheaper than translating all Bcel annotations into AnnotationAJ objects.
Author:
AndyClement
  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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.
    • hasNameValuePair

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

      public boolean hasNamedValue(String name)
      Specified by:
      hasNamedValue in interface AnnotationAJ
      Specified by:
      hasNamedValue in class AbstractAnnotationAJ
      Parameters:
      name - the name of the value
      Returns:
      true if there is a value with that name
    • 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)
    • 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
    • getBcelAnnotation

      public AnnotationGen getBcelAnnotation()
      Returns:
      return the real bcel annotation being wrapped
    • 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