org.aspectj.weaver.bcel
Class BcelAnnotation

java.lang.Object
  extended by org.aspectj.weaver.AbstractAnnotationAJ
      extended by 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.


Field Summary
 
Fields inherited from class org.aspectj.weaver.AbstractAnnotationAJ
type
 
Fields inherited from interface org.aspectj.weaver.AnnotationAJ
EMPTY_ARRAY
 
Constructor Summary
BcelAnnotation(AnnotationGen theBcelAnnotation, ResolvedType resolvedAnnotationType)
           
BcelAnnotation(AnnotationGen theBcelAnnotation, World world)
           
 
Method Summary
 AnnotationGen getBcelAnnotation()
           
 java.lang.String getStringFormOfValue(java.lang.String name)
          Determine the string representation of the value of a field.
 java.util.Set<java.lang.String> getTargets()
          
 boolean hasNamedValue(java.lang.String name)
          
 boolean hasNameValuePair(java.lang.String name, java.lang.String value)
          
 boolean isRuntimeVisible()
          
 java.lang.String stringify()
          
 java.lang.String toString()
           
 
Methods inherited from class org.aspectj.weaver.AbstractAnnotationAJ
allowedOnAnnotationType, allowedOnField, allowedOnRegularType, ensureAtTargetInitialized, getType, getTypeName, getTypeSignature, getValidTargets, specifiesTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BcelAnnotation

public BcelAnnotation(AnnotationGen theBcelAnnotation,
                      World world)

BcelAnnotation

public BcelAnnotation(AnnotationGen theBcelAnnotation,
                      ResolvedType resolvedAnnotationType)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getTargets

public java.util.Set<java.lang.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(java.lang.String name,
                                java.lang.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(java.lang.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 java.lang.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 java.lang.String getStringFormOfValue(java.lang.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