org.aspectj.weaver.patterns
Class TypePattern

java.lang.Object
  extended by org.aspectj.weaver.patterns.PatternNode
      extended by org.aspectj.weaver.patterns.TypePattern
All Implemented Interfaces:
IHasPosition, IHasSourceLocation
Direct Known Subclasses:
AndTypePattern, AnyTypePattern, AnyWithAnnotationTypePattern, EllipsisTypePattern, ExactTypePattern, HasMemberTypePattern, NotTypePattern, NoTypePattern, OrTypePattern, TypeCategoryTypePattern, WildTypePattern

public abstract class TypePattern
extends PatternNode

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


Nested Class Summary
static class TypePattern.MatchKind
           
 
Field Summary
static byte AND
           
protected  AnnotationTypePattern annotationPattern
           
static TypePattern ANY
           
static byte ANY_KEY
           
static byte ANY_WITH_ANNO
           
static byte BINDING
           
static TypePattern.MatchKind DYNAMIC
           
static TypePattern ELLIPSIS
           
static byte ELLIPSIS_KEY
           
static byte EXACT
           
static byte HAS_MEMBER
           
protected  boolean includeSubtypes
           
protected  boolean isVarArgs
           
static TypePattern NO
           
static byte NO_KEY
           
static byte NOT
           
static byte OR
           
static TypePattern.MatchKind STATIC
           
static byte TYPE_CATEGORY
           
protected  TypePatternList typeParameters
           
static byte WILD
           
 
Fields inherited from class org.aspectj.weaver.patterns.PatternNode
end, sourceContext, start
 
Constructor Summary
protected TypePattern(boolean includeSubtypes)
           
protected TypePattern(boolean includeSubtypes, boolean isVarArgs)
           
protected TypePattern(boolean includeSubtypes, boolean isVarArgs, TypePatternList typeParams)
           
 
Method Summary
protected  boolean couldEverMatchSameTypesAs(TypePattern other)
           
 AnnotationTypePattern getAnnotationPattern()
           
 UnresolvedType getExactType()
           
 TypePatternList getTypeParameters()
           
 boolean hasFailedResolution()
           
 boolean isArray()
           
 boolean isBangVoid()
          For quickly recognizing the pattern '!void'
 boolean isEllipsis()
           
 boolean isIncludeSubtypes()
           
 boolean isStar()
           
 boolean isStarAnnotation()
           
 boolean isVarArgs()
           
 boolean isVoid()
          for quickly recognizing the pattern 'void'
 FuzzyBoolean 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(java.util.Map<java.lang.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)
           
 TypePattern remapAdviceFormals(IntMap bindings)
          This is called during concretization of pointcuts, it is used by BindingTypePattern to return a new BindingTypePattern with a formal index appropiate for the advice, rather than for the lexical declaration, i.e.
 void resolve(World world)
           
 TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType)
          This can modify in place, or return a new TypePattern if the type changes.
 UnresolvedType resolveExactType(IScope scope, Bindings bindings)
           
 void setAnnotationTypePattern(AnnotationTypePattern annPatt)
           
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATIC

public static final TypePattern.MatchKind STATIC

DYNAMIC

public static final TypePattern.MatchKind DYNAMIC

ELLIPSIS

public static final TypePattern ELLIPSIS

ANY

public static final TypePattern ANY

NO

public static final TypePattern NO

includeSubtypes

protected boolean includeSubtypes

isVarArgs

protected boolean isVarArgs

annotationPattern

protected AnnotationTypePattern annotationPattern

typeParameters

protected TypePatternList 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 Detail

TypePattern

protected TypePattern(boolean includeSubtypes,
                      boolean isVarArgs,
                      TypePatternList typeParams)

TypePattern

protected TypePattern(boolean includeSubtypes,
                      boolean isVarArgs)

TypePattern

protected TypePattern(boolean includeSubtypes)
Method Detail

getAnnotationPattern

public AnnotationTypePattern getAnnotationPattern()

isVarArgs

public boolean isVarArgs()

isStarAnnotation

public boolean isStarAnnotation()

isArray

public boolean isArray()

setAnnotationTypePattern

public void setAnnotationTypePattern(AnnotationTypePattern annPatt)

setTypeParameters

public void setTypeParameters(TypePatternList typeParams)

getTypeParameters

public TypePatternList getTypeParameters()

setIsVarArgs

public void setIsVarArgs(boolean isVarArgs)

couldEverMatchSameTypesAs

protected boolean couldEverMatchSameTypesAs(TypePattern other)

matchesStatically

public boolean matchesStatically(ResolvedType type)

matchesInstanceof

public abstract FuzzyBoolean matchesInstanceof(ResolvedType type)

matches

public final FuzzyBoolean matches(ResolvedType type,
                                  TypePattern.MatchKind kind)

matchesExactly

protected abstract boolean matchesExactly(ResolvedType type)

matchesExactly

protected abstract boolean matchesExactly(ResolvedType type,
                                          ResolvedType annotatedType)

matchesSubtypes

protected boolean matchesSubtypes(ResolvedType type)

matchesSubtypes

protected boolean matchesSubtypes(ResolvedType superType,
                                  ResolvedType annotatedType)

resolveExactType

public UnresolvedType resolveExactType(IScope scope,
                                       Bindings bindings)

getExactType

public UnresolvedType getExactType()

notExactType

protected TypePattern notExactType(IScope s)

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

public void resolve(World world)

parameterizeWith

public abstract TypePattern parameterizeWith(java.util.Map<java.lang.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.


postRead

public void postRead(ResolvedType enclosingType)

isEllipsis

public boolean isEllipsis()

isStar

public boolean isStar()

remapAdviceFormals

public TypePattern remapAdviceFormals(IntMap bindings)
This is called during concretization of pointcuts, it is used by BindingTypePattern to return a new BindingTypePattern with a formal index appropiate for the advice, rather than for the lexical declaration, i.e. this handles transforamtions 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 java.io.IOException
Throws:
java.io.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()