org.aspectj.lang.reflect

Interface AjType<T>

All Superinterfaces:
AnnotatedElement, Type

public interface AjType<T>
extends Type, AnnotatedElement

The runtime representation of a type (Aspect, Class, Interface, Annotation, Enum, or Array) in an AspectJ program.

Method Summary

Advice
getAdvice(String name)
Returns the advice with the given name.
Advice[]
getAdvice(org.aspectj.lang.reflect.AdviceKind... ofTypes)
Returns all of the advice for this type, of an advice kind contained in the parameter list.
AjType[]
getAjTypes()
Returns an array containing all the public types that are members of this type
Constructor
getConstructor(AjType... parameterTypes)
Returns the constructor object for the specified public constructor of this type
Constructor[]
getConstructors()
Returns all of the public constructors of this type
DeclareAnnotation[]
getDeclareAnnotations()
Return all of the declare annotation members of this type, including declare annotation members inherited from super-types
DeclareErrorOrWarning[]
getDeclareErrorOrWarnings()
Returns all of the declare error and declare warning members of this type, including declare error/warning members inherited from super-types
DeclareParents[]
getDeclareParents()
Returns all of the declare parents members of this type, including declare parent members inherited from super-types
DeclarePrecedence[]
getDeclarePrecedence()
Return all of the declare precedence members of this type, including declare precedence members inherited from super-types
DeclareSoft[]
getDeclareSofts()
Return all of the declare soft members of this type, including declare soft members inherited from super-types
Advice
getDeclaredAdvice(String name)
Returns the advice declared in this type with the given name.
Advice[]
getDeclaredAdvice(org.aspectj.lang.reflect.AdviceKind... ofTypes)
Returns all of the advice declared by this type, of an advice kind contained in the parameter list.
AjType[]
getDeclaredAjTypes()
Returns an array containing all the types declared by this type
Constructor
getDeclaredConstructor(AjType... parameterTypes)
Returns the constructor object for the specified constructor of this type
Constructor[]
getDeclaredConstructors()
Returns all the constructors declared in this type
Field
getDeclaredField(String name)
Return the field declared in this type with the given name
Field[]
getDeclaredFields()
Returns all the fields declared in this type
InterTypeConstructorDeclaration
getDeclaredITDConstructor(AjType target, AjType... parameterTypes)
Return the inter-type constructor declared by this type matching the given specification
InterTypeConstructorDeclaration[]
getDeclaredITDConstructors()
Returns all of the inter-type constructors declared by this type
InterTypeFieldDeclaration
getDeclaredITDField(String name, AjType target)
Return the inter-type field declared in this type with the given specification
InterTypeFieldDeclaration[]
getDeclaredITDFields()
Return all of the inter-type fields declared in this type
InterTypeMethodDeclaration
getDeclaredITDMethod(String name, AjType target, AjType... parameterTypes)
Return the inter-type method declared by this type matching the given specification
InterTypeMethodDeclaration[]
getDeclaredITDMethods()
Return all of the inter-type methods declared by this type
Method
getDeclaredMethod(String name, AjType... parameterTypes)
Return the method object for the specified method declared in this type
Method[]
getDeclaredMethods()
Return all the methods declared by this type
Pointcut
getDeclaredPointcut(String name)
Return the pointcut object representing the specified pointcut declared by this type
Pointcut[]
getDeclaredPointcuts()
Returns all of the pointcuts declared by this type
AjType
getDeclaringType()
If this type is a member of another type, return the AjType representing the type in which it was declared.
Constructor
getEnclosingConstructor()
If this type represents a local or anonymous type declared within a constructor, return then enclosing Method object.
Method
getEnclosingMethod()
If this type represents a local or anonymous type declared within a method, return then enclosing Method object.
AjType
getEnclosingType()
Returns the immediately enclosing type of this type.
T[]
getEnumConstants()
Returns the elements of this enum class, or null if this type does not represent an enum type.
Field
getField(String name)
Return the public field with the given name
Field[]
getFields()
Return the public fields declared by this type
Type
getGenericSupertype()
The generic supertype of this type, as defined by Class.getGenericSupertype
InterTypeConstructorDeclaration
getITDConstructor(AjType target, AjType... parameterTypes)
Return the public inter-type constructor matching the given specification
InterTypeConstructorDeclaration[]
getITDConstructors()
Return all of the public inter-type constructors of this type
InterTypeFieldDeclaration
getITDField(String name, AjType target)
Return the public inter-type field matching the given specification
InterTypeFieldDeclaration[]
getITDFields()
Return all of the public inter-type fields for this type
InterTypeMethodDeclaration
getITDMethod(String name, AjType target, AjType... parameterTypes)
Return the public inter-type method of this type matching the given specification
InterTypeMethodDeclaration[]
getITDMethods()
Return all of the public inter-type declared methods of this type
AjType[]
getInterfaces()
The interfaces implemented by this type
Class
getJavaClass()
The java.lang.Class that corresponds to this AjType
Method
getMethod(String name, AjType... parameterTypes)
Return the method object for the specified public method declared in this type
Method[]
getMethods()
Returns all the public methods of this type
int
getModifiers()
The modifiers declared for this type.
String
getName()
The name of this type, in the same format as returned by Class.getName()
Package
getPackage()
The package in which this type is declared
PerClause
getPerClause()
If this type represents an aspect, returns the associated per-clause.
Pointcut
getPointcut(String name)
Return the pointcut object representing the specified public pointcut
Pointcut[]
getPointcuts()
Returns all of the public pointcuts of this type
AjType
getSupertype()
The supertype of this type.
TypeVariable>[]
getTypeParameters()
Returns an array of TypeVariable objects that represent the type variables declared by this type (if any)
boolean
isArray()
Return true if this is an array type
boolean
isAspect()
Return true if this is an aspect type
boolean
isEnum()
True if this is an enum type
boolean
isInstance(Object o)
True if the given object is assignment-compatible with an object of the type represented by this AjType
boolean
isInterface()
True if this is an interface type
boolean
isLocalClass()
Returns true if and only if the underlying type is a local class
boolean
isMemberAspect()
Returns true if and only if the underlying type is a member aspect
boolean
isMemberClass()
Returns true if and only if the underlying type is a member class
boolean
isPrimitive()
Return true if this object represents a primitive type
boolean
isPrivileged()
Returns true if and only if the underlying type is a privileged aspect

Method Details

getAdvice

public Advice getAdvice(String name)
            throws NoSuchAdviceException
Returns the advice with the given name. For an @AspectJ declared advice member, this is the name of the annotated method. For a code-style advice declaration, this is the name given in the @AdviceName annotation if present.

getAdvice

public Advice[] getAdvice(org.aspectj.lang.reflect.AdviceKind... ofTypes)
Returns all of the advice for this type, of an advice kind contained in the parameter list.

getAjTypes

public AjType[] getAjTypes()
Returns an array containing all the public types that are members of this type

getConstructor

public Constructor getConstructor(AjType... parameterTypes)
            throws NoSuchMethodException
Returns the constructor object for the specified public constructor of this type

getConstructors

public Constructor[] getConstructors()
Returns all of the public constructors of this type

getDeclareAnnotations

public DeclareAnnotation[] getDeclareAnnotations()
Return all of the declare annotation members of this type, including declare annotation members inherited from super-types

getDeclareErrorOrWarnings

public DeclareErrorOrWarning[] getDeclareErrorOrWarnings()
Returns all of the declare error and declare warning members of this type, including declare error/warning members inherited from super-types

getDeclareParents

public DeclareParents[] getDeclareParents()
Returns all of the declare parents members of this type, including declare parent members inherited from super-types

getDeclarePrecedence

public DeclarePrecedence[] getDeclarePrecedence()
Return all of the declare precedence members of this type, including declare precedence members inherited from super-types

getDeclareSofts

public DeclareSoft[] getDeclareSofts()
Return all of the declare soft members of this type, including declare soft members inherited from super-types

getDeclaredAdvice

public Advice getDeclaredAdvice(String name)
            throws NoSuchAdviceException
Returns the advice declared in this type with the given name. For an @AspectJ declared advice member, this is the name of the annotated method. For a code-style advice declaration, this is the name given in the @AdviceName annotation if present.

getDeclaredAdvice

public Advice[] getDeclaredAdvice(org.aspectj.lang.reflect.AdviceKind... ofTypes)
Returns all of the advice declared by this type, of an advice kind contained in the parameter list.

getDeclaredAjTypes

public AjType[] getDeclaredAjTypes()
Returns an array containing all the types declared by this type

getDeclaredConstructor

public Constructor getDeclaredConstructor(AjType... parameterTypes)
            throws NoSuchMethodException
Returns the constructor object for the specified constructor of this type

getDeclaredConstructors

public Constructor[] getDeclaredConstructors()
Returns all the constructors declared in this type

getDeclaredField

public Field getDeclaredField(String name)
            throws NoSuchFieldException
Return the field declared in this type with the given name

getDeclaredFields

public Field[] getDeclaredFields()
Returns all the fields declared in this type

getDeclaredITDConstructor

public InterTypeConstructorDeclaration getDeclaredITDConstructor(AjType target,
                                                                 AjType... parameterTypes)
            throws NoSuchMethodException
Return the inter-type constructor declared by this type matching the given specification

getDeclaredITDConstructors

public InterTypeConstructorDeclaration[] getDeclaredITDConstructors()
Returns all of the inter-type constructors declared by this type

getDeclaredITDField

public InterTypeFieldDeclaration getDeclaredITDField(String name,
                                                     AjType target)
            throws NoSuchFieldException
Return the inter-type field declared in this type with the given specification

getDeclaredITDFields

public InterTypeFieldDeclaration[] getDeclaredITDFields()
Return all of the inter-type fields declared in this type

getDeclaredITDMethod

public InterTypeMethodDeclaration getDeclaredITDMethod(String name,
                                                       AjType target,
                                                       AjType... parameterTypes)
            throws NoSuchMethodException
Return the inter-type method declared by this type matching the given specification

getDeclaredITDMethods

public InterTypeMethodDeclaration[] getDeclaredITDMethods()
Return all of the inter-type methods declared by this type

getDeclaredMethod

public Method getDeclaredMethod(String name,
                                AjType... parameterTypes)
            throws NoSuchMethodException
Return the method object for the specified method declared in this type

getDeclaredMethods

public Method[] getDeclaredMethods()
Return all the methods declared by this type

getDeclaredPointcut

public Pointcut getDeclaredPointcut(String name)
            throws NoSuchPointcutException
Return the pointcut object representing the specified pointcut declared by this type

getDeclaredPointcuts

public Pointcut[] getDeclaredPointcuts()
Returns all of the pointcuts declared by this type

getDeclaringType

public AjType getDeclaringType()
If this type is a member of another type, return the AjType representing the type in which it was declared.

getEnclosingConstructor

public Constructor getEnclosingConstructor()
If this type represents a local or anonymous type declared within a constructor, return then enclosing Method object.

getEnclosingMethod

public Method getEnclosingMethod()
If this type represents a local or anonymous type declared within a method, return then enclosing Method object.

getEnclosingType

public AjType getEnclosingType()
Returns the immediately enclosing type of this type.

getEnumConstants

public T[] getEnumConstants()
Returns the elements of this enum class, or null if this type does not represent an enum type.

getField

public Field getField(String name)
            throws NoSuchFieldException
Return the public field with the given name

getFields

public Field[] getFields()
Return the public fields declared by this type

getGenericSupertype

public Type getGenericSupertype()
The generic supertype of this type, as defined by Class.getGenericSupertype

getITDConstructor

public InterTypeConstructorDeclaration getITDConstructor(AjType target,
                                                         AjType... parameterTypes)
            throws NoSuchMethodException
Return the public inter-type constructor matching the given specification

getITDConstructors

public InterTypeConstructorDeclaration[] getITDConstructors()
Return all of the public inter-type constructors of this type

getITDField

public InterTypeFieldDeclaration getITDField(String name,
                                             AjType target)
            throws NoSuchFieldException
Return the public inter-type field matching the given specification

getITDFields

public InterTypeFieldDeclaration[] getITDFields()
Return all of the public inter-type fields for this type

getITDMethod

public InterTypeMethodDeclaration getITDMethod(String name,
                                               AjType target,
                                               AjType... parameterTypes)
            throws NoSuchMethodException
Return the public inter-type method of this type matching the given specification

getITDMethods

public InterTypeMethodDeclaration[] getITDMethods()
Return all of the public inter-type declared methods of this type

getInterfaces

public AjType[] getInterfaces()
The interfaces implemented by this type

getJavaClass

public Class getJavaClass()
The java.lang.Class that corresponds to this AjType

getMethod

public Method getMethod(String name,
                        AjType... parameterTypes)
            throws NoSuchMethodException
Return the method object for the specified public method declared in this type

getMethods

public Method[] getMethods()
Returns all the public methods of this type

getModifiers

public int getModifiers()
The modifiers declared for this type. The return value can be interpreted using java.lang.reflect.Modifier

getName

public String getName()
The name of this type, in the same format as returned by Class.getName()

getPackage

public Package getPackage()
The package in which this type is declared

getPerClause

public PerClause getPerClause()
If this type represents an aspect, returns the associated per-clause. Returns null for non-aspect types.

getPointcut

public Pointcut getPointcut(String name)
            throws NoSuchPointcutException
Return the pointcut object representing the specified public pointcut

getPointcuts

public Pointcut[] getPointcuts()
Returns all of the public pointcuts of this type

getSupertype

public AjType getSupertype()
The supertype of this type. If this type represents Object or a primitive type then null is returned.

getTypeParameters

public TypeVariable>[] getTypeParameters()
Returns an array of TypeVariable objects that represent the type variables declared by this type (if any)

isArray

public boolean isArray()
Return true if this is an array type

isAspect

public boolean isAspect()
Return true if this is an aspect type

isEnum

public boolean isEnum()
True if this is an enum type

isInstance

public boolean isInstance(Object o)
True if the given object is assignment-compatible with an object of the type represented by this AjType

isInterface

public boolean isInterface()
True if this is an interface type

isLocalClass

public boolean isLocalClass()
Returns true if and only if the underlying type is a local class

isMemberAspect

public boolean isMemberAspect()
Returns true if and only if the underlying type is a member aspect

isMemberClass

public boolean isMemberClass()
Returns true if and only if the underlying type is a member class

isPrimitive

public boolean isPrimitive()
Return true if this object represents a primitive type

isPrivileged

public boolean isPrivileged()
Returns true if and only if the underlying type is a privileged aspect