Class DeclareAnnotation
java.lang.Object
org.aspectj.weaver.patterns.PatternNode
org.aspectj.weaver.patterns.Declare
org.aspectj.weaver.patterns.DeclareAnnotation
- All Implemented Interfaces:
IHasPosition
,IHasSourceLocation
Represents a declare annotation statement, one of atField, atMethod, atConstructor or atType.
- Author:
- Andy Clement
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Captures type of declare annotation (method/type/field/constructor) -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DeclareAnnotation.Kind
static final DeclareAnnotation.Kind
static final DeclareAnnotation.Kind
static final DeclareAnnotation.Kind
static final DeclareAnnotation.Kind
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
ConstructorsConstructorDescriptionDeclareAnnotation
(DeclareAnnotation.Kind kind, ISignaturePattern sigPattern) Constructor for declare atMethod/atField/atConstructor.DeclareAnnotation
(DeclareAnnotation.Kind kind, TypePattern typePattern) Constructor for declare atType. -
Method Summary
Modifier and TypeMethodDescriptionaccept
(PatternNodeVisitor visitor, 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
int
int
Returns the string, useful before the real annotation has been resolvedgetKind()
Provide a name suffix so that we can tell the different declare annotations forms apart in the AjProblemReporterint
hashCode()
boolean
Indicates if this declare should be treated like advice.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
matches
(ResolvedMember resolvedmember, World world) For declare atConstructor, atMethod, atFieldboolean
matches
(ResolvedType type) For declare atType.parameterizeWith
(Map<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
Returns this declare mutatedvoid
setAnnotationLocation
(int start, int end) void
setAnnotationMethod
(String methodName) void
setAnnotationString
(String annotationString) void
setAspect
(ResolvedType typeX) void
setRemover
(boolean b) toString()
traverse
(PatternNodeVisitor visitor, Object data) void
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, writeLocation
-
Field Details
-
AT_TYPE
-
AT_FIELD
-
AT_METHOD
-
AT_CONSTRUCTOR
-
AT_REMOVE_FROM_FIELD
-
-
Constructor Details
-
DeclareAnnotation
Constructor for declare atType. -
DeclareAnnotation
Constructor for declare atMethod/atField/atConstructor.
-
-
Method Details
-
getAnnotationString
Returns the string, useful before the real annotation has been resolved -
isExactPattern
public boolean isExactPattern() -
getAnnotationMethod
-
toString
-
accept
- Specified by:
accept
in classPatternNode
-
traverse
- Overrides:
traverse
in classPatternNode
-
resolve
-
parameterizeWith
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 classDeclare
-
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 classDeclare
-
setAnnotationString
-
setAnnotationLocation
public void setAnnotationLocation(int start, int end) -
getAnnotationSourceStart
public int getAnnotationSourceStart() -
getAnnotationSourceEnd
public int getAnnotationSourceEnd() -
setAnnotationMethod
-
equals
-
hashCode
-
write
- Specified by:
write
in classPatternNode
- Throws:
IOException
-
read
- Throws:
IOException
-
matches
For declare atConstructor, atMethod, atField -
matches
For declare atType. -
setAspect
-
getAspect
-
copyAnnotationTo
-
getAnnotation
- Returns:
- declared annotation; can be null for annotations with SOURCE retention, which of course are not present in the byte code
-
getTypePattern
-
getSignaturePattern
-
isStarredAnnotationPattern
public boolean isStarredAnnotationPattern() -
getKind
-
isDeclareAtConstuctor
public boolean isDeclareAtConstuctor() -
isDeclareAtMethod
public boolean isDeclareAtMethod() -
isDeclareAtType
public boolean isDeclareAtType() -
isDeclareAtField
public boolean isDeclareAtField() -
getAnnotationType
- Returns:
- the type of the annotation; can be null for annotations with SOURCE retention, which of course are not present in the byte code
-
isAnnotationAllowedOnField
public boolean isAnnotationAllowedOnField()- Returns:
- true if the annotation specified is allowed on a field
-
getPatternAsString
-
couldEverMatch
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
Provide a name suffix so that we can tell the different declare annotations forms apart in the AjProblemReporter- Specified by:
getNameSuffix
in classDeclare
-
setRemover
public void setRemover(boolean b) -
isRemover
public boolean isRemover()
-