org.aspectj.weaver
Class StandardAnnotation

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


Field Summary
 
Fields inherited from class org.aspectj.weaver.AbstractAnnotationAJ
type
 
Fields inherited from interface org.aspectj.weaver.AnnotationAJ
EMPTY_ARRAY
 
Constructor Summary
StandardAnnotation(ResolvedType type, boolean isRuntimeVisible)
           
 
Method Summary
 void addNameValuePair(AnnotationNameValuePair pair)
           
 java.util.List<AnnotationNameValuePair> getNameValuePairs()
           
 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 n)
          
 boolean hasNameValuePair(java.lang.String n, java.lang.String v)
          
 boolean hasNameValuePairs()
           
 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

StandardAnnotation

public StandardAnnotation(ResolvedType type,
                          boolean isRuntimeVisible)
Method Detail

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 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)

toString

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

hasNamedValue

public boolean hasNamedValue(java.lang.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(java.lang.String n,
                                java.lang.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 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.

getNameValuePairs

public java.util.List<AnnotationNameValuePair> getNameValuePairs()

hasNameValuePairs

public boolean hasNameValuePairs()

addNameValuePair

public void addNameValuePair(AnnotationNameValuePair pair)

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