org.aspectj.weaver.patterns
Class DeclareAnnotation

java.lang.Object
  extended by org.aspectj.weaver.patterns.PatternNode
      extended by org.aspectj.weaver.patterns.Declare
          extended by org.aspectj.weaver.patterns.DeclareAnnotation
All Implemented Interfaces:
IHasPosition, IHasSourceLocation

public class DeclareAnnotation
extends Declare

Represents a declare annotation statement, one of atField, atMethod, atConstructor or atType.


Nested Class Summary
static class DeclareAnnotation.Kind
          Captures type of declare annotation (method/type/field/constructor)
 
Field Summary
static DeclareAnnotation.Kind AT_CONSTRUCTOR
           
static DeclareAnnotation.Kind AT_FIELD
           
static DeclareAnnotation.Kind AT_METHOD
           
static DeclareAnnotation.Kind AT_REMOVE_FROM_FIELD
           
static DeclareAnnotation.Kind AT_TYPE
           
 
Fields inherited from class org.aspectj.weaver.patterns.Declare
ANNOTATION, DOMINATES, ERROR_OR_WARNING, PARENTS, PARENTSMIXIN, SOFT, TYPE_ERROR_OR_WARNING
 
Fields inherited from class org.aspectj.weaver.patterns.PatternNode
end, sourceContext, start
 
Constructor Summary
DeclareAnnotation(DeclareAnnotation.Kind kind, ISignaturePattern sigPattern)
          Constructor for declare atMethod/atField/atConstructor.
DeclareAnnotation(DeclareAnnotation.Kind kind, TypePattern typePattern)
          Constructor for declare atType.
 
Method Summary
 java.lang.Object accept(PatternNodeVisitor visitor, java.lang.Object data)
           
 void copyAnnotationTo(ResolvedType onType)
           
 boolean couldEverMatch(ResolvedType type)
          Return true if this declare annotation could ever match something in the specified type - only really able to make intelligent decision if a type was specified in the sig/type pattern signature.
 boolean equals(java.lang.Object obj)
           
 AnnotationAJ getAnnotation()
           
 java.lang.String getAnnotationMethod()
           
 int getAnnotationSourceEnd()
           
 int getAnnotationSourceStart()
           
 java.lang.String getAnnotationString()
          Returns the string, useful before the real annotation has been resolved
 ResolvedType getAnnotationType()
           
 UnresolvedType getAspect()
           
 DeclareAnnotation.Kind getKind()
           
 java.lang.String getNameSuffix()
          Provide a name suffix so that we can tell the different declare annotations forms apart in the AjProblemReporter
 java.lang.String getPatternAsString()
           
 ISignaturePattern getSignaturePattern()
           
 TypePattern getTypePattern()
           
 int hashCode()
           
 boolean isAdviceLike()
          Indicates if this declare should be treated like advice.
 boolean isAnnotationAllowedOnField()
           
 boolean isDeclareAtConstuctor()
           
 boolean isDeclareAtField()
           
 boolean isDeclareAtMethod()
           
 boolean isDeclareAtType()
           
 boolean isExactPattern()
           
 boolean isRemover()
           
 boolean isStarredAnnotationPattern()
           
 boolean matches(ResolvedMember resolvedmember, World world)
          For declare atConstructor, atMethod, atField
 boolean matches(ResolvedType type)
          For declare atType.
 Declare parameterizeWith(java.util.Map<java.lang.String,UnresolvedType> typeVariableBindingMap, World w)
          Returns a version of this declare element in which all references to type variables are replaced with their bindings given in the map.
static Declare read(VersionedDataInputStream s, ISourceContext context)
           
 void resolve(IScope scope)
          Returns this declare mutated
 void setAnnotationLocation(int start, int end)
           
 void setAnnotationMethod(java.lang.String methodName)
           
 void setAnnotationString(java.lang.String annotationString)
           
 void setAspect(ResolvedType typeX)
           
 void setRemover(boolean b)
           
 java.lang.String toString()
           
 void write(CompressingDataOutputStream s)
           
 
Methods inherited from class org.aspectj.weaver.patterns.Declare
getDeclaringType, setDeclaringType
 
Methods inherited from class org.aspectj.weaver.patterns.PatternNode
copyLocationFrom, getEnd, getFileName, getSourceContext, getSourceLocation, getStart, readLocation, setLocation, traverse, writeLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AT_TYPE

public static final DeclareAnnotation.Kind AT_TYPE

AT_FIELD

public static final DeclareAnnotation.Kind AT_FIELD

AT_METHOD

public static final DeclareAnnotation.Kind AT_METHOD

AT_CONSTRUCTOR

public static final DeclareAnnotation.Kind AT_CONSTRUCTOR

AT_REMOVE_FROM_FIELD

public static final DeclareAnnotation.Kind AT_REMOVE_FROM_FIELD
Constructor Detail

DeclareAnnotation

public DeclareAnnotation(DeclareAnnotation.Kind kind,
                         TypePattern typePattern)
Constructor for declare atType.


DeclareAnnotation

public DeclareAnnotation(DeclareAnnotation.Kind kind,
                         ISignaturePattern sigPattern)
Constructor for declare atMethod/atField/atConstructor.

Method Detail

getAnnotationString

public java.lang.String getAnnotationString()
Returns the string, useful before the real annotation has been resolved


isExactPattern

public boolean isExactPattern()

getAnnotationMethod

public java.lang.String getAnnotationMethod()

toString

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

accept

public java.lang.Object accept(PatternNodeVisitor visitor,
                               java.lang.Object data)
Specified by:
accept in class PatternNode

resolve

public void resolve(IScope scope)
Description copied from class: Declare
Returns this declare mutated

Specified by:
resolve in class Declare

parameterizeWith

public Declare parameterizeWith(java.util.Map<java.lang.String,UnresolvedType> typeVariableBindingMap,
                                World w)
Description copied from class: Declare
Returns a version of this declare element in which all references to type variables are replaced with their bindings given in the map.

Specified by:
parameterizeWith in class Declare

isAdviceLike

public boolean isAdviceLike()
Description copied from class: Declare
Indicates if this declare should be treated like advice. If true, the declare will have no effect in an abstract aspect. It will be inherited by any concrete aspects and will have an effect for each concrete aspect it is ultimately inherited by.

Specified by:
isAdviceLike in class Declare

setAnnotationString

public void setAnnotationString(java.lang.String annotationString)

setAnnotationLocation

public void setAnnotationLocation(int start,
                                  int end)

getAnnotationSourceStart

public int getAnnotationSourceStart()

getAnnotationSourceEnd

public int getAnnotationSourceEnd()

setAnnotationMethod

public void setAnnotationMethod(java.lang.String methodName)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

write

public void write(CompressingDataOutputStream s)
           throws java.io.IOException
Specified by:
write in class PatternNode
Throws:
java.io.IOException

read

public static Declare read(VersionedDataInputStream s,
                           ISourceContext context)
                    throws java.io.IOException
Throws:
java.io.IOException

matches

public boolean matches(ResolvedMember resolvedmember,
                       World world)
For declare atConstructor, atMethod, atField


matches

public boolean matches(ResolvedType type)
For declare atType.


setAspect

public void setAspect(ResolvedType typeX)

getAspect

public UnresolvedType getAspect()

copyAnnotationTo

public void copyAnnotationTo(ResolvedType onType)

getAnnotation

public AnnotationAJ getAnnotation()

getTypePattern

public TypePattern getTypePattern()

getSignaturePattern

public ISignaturePattern getSignaturePattern()

isStarredAnnotationPattern

public boolean isStarredAnnotationPattern()

getKind

public DeclareAnnotation.Kind getKind()

isDeclareAtConstuctor

public boolean isDeclareAtConstuctor()

isDeclareAtMethod

public boolean isDeclareAtMethod()

isDeclareAtType

public boolean isDeclareAtType()

isDeclareAtField

public boolean isDeclareAtField()

getAnnotationType

public ResolvedType getAnnotationType()
Returns:
the type of the annotation

isAnnotationAllowedOnField

public boolean isAnnotationAllowedOnField()
Returns:
true if the annotation specified is allowed on a field

getPatternAsString

public java.lang.String getPatternAsString()

couldEverMatch

public boolean couldEverMatch(ResolvedType type)
Return true if this declare annotation could ever match something in the specified type - only really able to make intelligent decision if a type was specified in the sig/type pattern signature.


getNameSuffix

public java.lang.String getNameSuffix()
Provide a name suffix so that we can tell the different declare annotations forms apart in the AjProblemReporter

Specified by:
getNameSuffix in class Declare

setRemover

public void setRemover(boolean b)

isRemover

public boolean isRemover()