Package org.aspectj.weaver.patterns
Class TypePattern
java.lang.Object
org.aspectj.weaver.patterns.PatternNode
org.aspectj.weaver.patterns.TypePattern
- All Implemented Interfaces:
IHasPosition
,IHasSourceLocation
- Direct Known Subclasses:
AndTypePattern
,AnyTypePattern
,AnyWithAnnotationTypePattern
,EllipsisTypePattern
,ExactTypePattern
,HasMemberTypePattern
,NotTypePattern
,NoTypePattern
,OrTypePattern
,TypeCategoryTypePattern
,WildTypePattern
On creation, type pattern only contains WildTypePattern nodes, not BindingType or ExactType.
Then we call resolveBindings() during compilation During concretization of enclosing pointcuts, we call remapAdviceFormals
- Author:
- Erik Hilsdale, Jim Hugunin
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic byte
protected AnnotationTypePattern
static TypePattern
static byte
static byte
static byte
static TypePattern.MatchKind
static TypePattern
static byte
static byte
static byte
protected boolean
protected boolean
static TypePattern
static byte
static byte
static byte
static TypePattern.MatchKind
static byte
protected TypePatternList
static byte
Fields inherited from class org.aspectj.weaver.patterns.PatternNode
end, sourceContext, start
-
Constructor Summary
ModifierConstructorDescriptionprotected
TypePattern(boolean includeSubtypes)
protected
TypePattern(boolean includeSubtypes, boolean isVarArgs)
protected
TypePattern(boolean includeSubtypes, boolean isVarArgs, TypePatternList typeParams)
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
couldEverMatchSameTypesAs(TypePattern other)
boolean
boolean
isArray()
boolean
For quickly recognizing the pattern '!boolean
boolean
boolean
isStar()
boolean
boolean
boolean
isVoid()
for quickly recognizing the pattern 'void'matches(ResolvedType type, TypePattern.MatchKind kind)
protected abstract boolean
matchesExactly(ResolvedType type)
protected abstract boolean
matchesExactly(ResolvedType type, ResolvedType annotatedType)
abstract FuzzyBoolean
matchesInstanceof(ResolvedType type)
boolean
matchesStatically(ResolvedType type)
protected boolean
matchesSubtypes(ResolvedType type)
protected boolean
matchesSubtypes(ResolvedType superType, ResolvedType annotatedType)
protected TypePattern
notExactType(IScope s)
abstract TypePattern
parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w)
return a version of this type pattern in which all type variable references have been replaced by their corresponding entry in the map.void
postRead(ResolvedType enclosingType)
static TypePattern
read(VersionedDataInputStream s, ISourceContext context)
remapAdviceFormals(IntMap bindings)
This is called during concretization of pointcuts, it is used by BindingTypePattern to return a new BindingTypePattern with a formal index appropriate for the advice, rather than for the lexical declaration, i.e. this handles transformations through named pointcuts.void
resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType)
This can modify in place, or return a new TypePattern if the type changes.resolveExactType(IScope scope, Bindings bindings)
void
void
setIsVarArgs(boolean isVarArgs)
void
setTypeParameters(TypePatternList typeParams)
Methods inherited from class org.aspectj.weaver.patterns.PatternNode
accept, copyLocationFrom, getEnd, getFileName, getSourceContext, getSourceLocation, getStart, readLocation, setLocation, traverse, write, writeLocation
-
Field Details
-
STATIC
-
DYNAMIC
-
ELLIPSIS
-
ANY
-
NO
-
includeSubtypes
protected boolean includeSubtypes -
isVarArgs
protected boolean isVarArgs -
annotationPattern
-
typeParameters
-
WILD
public static final byte WILD- See Also:
- Constant Field Values
-
EXACT
public static final byte EXACT- See Also:
- Constant Field Values
-
BINDING
public static final byte BINDING- See Also:
- Constant Field Values
-
ELLIPSIS_KEY
public static final byte ELLIPSIS_KEY- See Also:
- Constant Field Values
-
ANY_KEY
public static final byte ANY_KEY- See Also:
- Constant Field Values
-
NOT
public static final byte NOT- See Also:
- Constant Field Values
-
OR
public static final byte OR- See Also:
- Constant Field Values
-
AND
public static final byte AND- See Also:
- Constant Field Values
-
NO_KEY
public static final byte NO_KEY- See Also:
- Constant Field Values
-
ANY_WITH_ANNO
public static final byte ANY_WITH_ANNO- See Also:
- Constant Field Values
-
HAS_MEMBER
public static final byte HAS_MEMBER- See Also:
- Constant Field Values
-
TYPE_CATEGORY
public static final byte TYPE_CATEGORY- See Also:
- Constant Field Values
-
-
Constructor Details
-
TypePattern
-
TypePattern
protected TypePattern(boolean includeSubtypes, boolean isVarArgs) -
TypePattern
protected TypePattern(boolean includeSubtypes)
-
-
Method Details
-
getAnnotationPattern
-
isVarArgs
public boolean isVarArgs() -
isStarAnnotation
public boolean isStarAnnotation() -
isArray
public boolean isArray() -
setAnnotationTypePattern
-
setTypeParameters
-
getTypeParameters
-
setIsVarArgs
public void setIsVarArgs(boolean isVarArgs) -
couldEverMatchSameTypesAs
-
matchesStatically
-
matchesInstanceof
-
matches
-
matchesExactly
-
matchesExactly
-
matchesSubtypes
-
matchesSubtypes
-
resolveExactType
-
getExactType
-
notExactType
-
resolveBindings
public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType)This can modify in place, or return a new TypePattern if the type changes. -
resolve
-
parameterizeWith
return a version of this type pattern in which all type variable references have been replaced by their corresponding entry in the map. -
postRead
-
isEllipsis
public boolean isEllipsis() -
isStar
public boolean isStar() -
remapAdviceFormals
This is called during concretization of pointcuts, it is used by BindingTypePattern to return a new BindingTypePattern with a formal index appropriate for the advice, rather than for the lexical declaration, i.e. this handles transformations through named pointcuts.pointcut foo(String name): args(name); --> This makes a BindingTypePattern(0) pointing to the 0th formal before(Foo f, String n): this(f) && foo(n) { ... } --> when resolveReferences is called on the args from the above, it will return a BindingTypePattern(1) before(Foo f): this(f) && foo(*) { ... } --> when resolveReferences is called on the args from the above, it will return an ExactTypePattern(String)
-
read
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException- Throws:
IOException
-
isIncludeSubtypes
public boolean isIncludeSubtypes() -
isBangVoid
public boolean isBangVoid()For quickly recognizing the pattern '!void' -
isVoid
public boolean isVoid()for quickly recognizing the pattern 'void' -
hasFailedResolution
public boolean hasFailedResolution()
-