org.aspectj.internal.lang.reflect

## Class AjTypeImpl<T>

- java.lang.Object
- - org.aspectj.internal.lang.reflect.AjTypeImpl<T>

All Implemented Interfaces:
  AnnotatedElement, Type, AjType<T>

    public class AjTypeImpl<T>
    extends Object
    implements AjType<T>

Author:
  colyer

### Constructor Summary

Constructors
Constructor and Description
`AjTypeImpl(Class<T> fromClass)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(Object obj)`
`Advice[]` `getAdvice(AdviceKind... ofType)`
`Advice` `getAdvice(String name)` For an annotation style advice member, this is the name of the annotated method.
`AjType<?>[]` `getAjTypes()`
`<A extends Annotation> A` `getAnnotation(Class<A> annotationType)`
`Annotation[]` `getAnnotations()`
`Constructor` `getConstructor(AjType<?>... parameterTypes)`
`Constructor[]` `getConstructors()`
`DeclareAnnotation[]` `getDeclareAnnotations()`
`Advice[]` `getDeclaredAdvice(AdviceKind... ofType)`
`Advice` `getDeclaredAdvice(String name)` For an annotation style advice member, this is the name of the annotated method.
`AjType<?>[]` `getDeclaredAjTypes()`
`Annotation[]` `getDeclaredAnnotations()`
`Constructor` `getDeclaredConstructor(AjType<?>... parameterTypes)`
`Constructor[]` `getDeclaredConstructors()`
`Field` `getDeclaredField(String name)`
`Field[]` `getDeclaredFields()`
`InterTypeConstructorDeclaration` `getDeclaredITDConstructor(AjType<?> target, AjType<?>... parameterTypes)`
`InterTypeConstructorDeclaration[]` `getDeclaredITDConstructors()`
`InterTypeFieldDeclaration` `getDeclaredITDField(String name, AjType<?> target)`
`InterTypeFieldDeclaration[]` `getDeclaredITDFields()`
`InterTypeMethodDeclaration` `getDeclaredITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes)`
`InterTypeMethodDeclaration[]` `getDeclaredITDMethods()`
`Method` `getDeclaredMethod(String name, AjType<?>... parameterTypes)`
`Method[]` `getDeclaredMethods()`
`Pointcut` `getDeclaredPointcut(String name)`
`Pointcut[]` `getDeclaredPointcuts()`
`DeclareErrorOrWarning[]` `getDeclareErrorOrWarnings()`
`DeclareParents[]` `getDeclareParents()`
`DeclarePrecedence[]` `getDeclarePrecedence()`
`DeclareSoft[]` `getDeclareSofts()`
`AjType<?>` `getDeclaringType()`
`Constructor` `getEnclosingConstructor()`
`Method` `getEnclosingMethod()`
`AjType<?>` `getEnclosingType()`
`T[]` `getEnumConstants()`
`Field` `getField(String name)`
`Field[]` `getFields()`
`Type` `getGenericSupertype()`
`AjType<?>[]` `getInterfaces()`
`InterTypeConstructorDeclaration` `getITDConstructor(AjType<?> target, AjType<?>... parameterTypes)`
`InterTypeConstructorDeclaration[]` `getITDConstructors()`
`InterTypeFieldDeclaration` `getITDField(String name, AjType<?> target)`
`InterTypeFieldDeclaration[]` `getITDFields()`
`InterTypeMethodDeclaration` `getITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes)`
`InterTypeMethodDeclaration[]` `getITDMethods()`
`Class<T>` `getJavaClass()`
`Method` `getMethod(String name, AjType<?>... parameterTypes)`
`Method[]` `getMethods()`
`int` `getModifiers()`
`String` `getName()`
`Package` `getPackage()`
`PerClause` `getPerClause()`
`Pointcut` `getPointcut(String name)`
`Pointcut[]` `getPointcuts()`
`AjType<? super T>` `getSupertype()`
`TypeVariable<Class<T>>[]` `getTypeParameters()`
`int` `hashCode()`
`boolean` `isAnnotationPresent(Class<? extends Annotation> annotationType)`
`boolean` `isArray()`
`boolean` `isAspect()`
`boolean` `isEnum()`
`boolean` `isInstance(Object o)`
`boolean` `isInterface()`
`boolean` `isLocalClass()`
`boolean` `isMemberAspect()`
`boolean` `isMemberClass()`
`boolean` `isPrimitive()`
`boolean` `isPrivileged()`
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.reflect.Type

`getTypeName`

### Methods inherited from interface java.lang.reflect.AnnotatedElement

`getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType`

### Constructor Detail

#### AjTypeImpl

    public AjTypeImpl(Class<T> fromClass)

### Method Detail

#### getName

    public String getName()

Specified by:
  `getName` in interface `AjType<T>`
Returns:
  the name of this type, in the same format as returned by Class.getName()

#### getPackage

    public Package getPackage()

Specified by:
  `getPackage` in interface `AjType<T>`
Returns:
  the package in which this type is declared

#### getInterfaces

    public AjType<?>[] getInterfaces()

Specified by:
  `getInterfaces` in interface `AjType<T>`
Returns:
  the interfaces implemented by this type

#### getModifiers

    public int getModifiers()

Specified by:
  `getModifiers` in interface `AjType<T>`
Returns:
  the modifiers declared for this type. The return value can be interpreted using java.lang.reflect.Modifier

#### getJavaClass

    public Class<T> getJavaClass()

Specified by:
  `getJavaClass` in interface `AjType<T>`
Returns:
  the java.lang.Class that corresponds to this AjType

#### getSupertype

    public AjType<? super T> getSupertype()

Specified by:
  `getSupertype` in interface `AjType<T>`
Returns:
  the supertype of this type. If this type represents Object or a primitive type then null is returned.

#### getGenericSupertype

    public Type getGenericSupertype()

Specified by:
  `getGenericSupertype` in interface `AjType<T>`
Returns:
  the generic supertype of this type, as defined by Class.getGenericSupertype

#### getEnclosingMethod

    public Method getEnclosingMethod()

Specified by:
  `getEnclosingMethod` in interface `AjType<T>`
Returns:
  the enclosing Method if this type represents a local or anonymous type declared within a method

#### getEnclosingConstructor

    public Constructor getEnclosingConstructor()

Specified by:
  `getEnclosingConstructor` in interface `AjType<T>`
Returns:
  the enclosing Method if this type represents a local or anonymous type declared within a constructor

#### getEnclosingType

    public AjType<?> getEnclosingType()

Specified by:
  `getEnclosingType` in interface `AjType<T>`
Returns:
  the immediately enclosing type of this type.

#### getDeclaringType

    public AjType<?> getDeclaringType()

Specified by:
  `getDeclaringType` in interface `AjType<T>`
Returns:
  the AjType representing the typei n which it was declared (if this type is a member of another type)

#### getPerClause

    public PerClause getPerClause()

Specified by:
  `getPerClause` in interface `AjType<T>`
Returns:
  the per-clause if this is an aspect, otherwise null

#### isAnnotationPresent

    public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)

Specified by:
  `isAnnotationPresent` in interface `AnnotatedElement`

#### getAnnotation

    public <A extends Annotation> A getAnnotation(Class<A> annotationType)

Specified by:
  `getAnnotation` in interface `AnnotatedElement`

#### getAnnotations

    public Annotation[] getAnnotations()

Specified by:
  `getAnnotations` in interface `AnnotatedElement`

#### getDeclaredAnnotations

    public Annotation[] getDeclaredAnnotations()

Specified by:
  `getDeclaredAnnotations` in interface `AnnotatedElement`

#### getAjTypes

    public AjType<?>[] getAjTypes()

Specified by:
  `getAjTypes` in interface `AjType<T>`
Returns:
  an array containing all the public types that are members of this type

#### getDeclaredAjTypes

    public AjType<?>[] getDeclaredAjTypes()

Specified by:
  `getDeclaredAjTypes` in interface `AjType<T>`
Returns:
  an array containing all the types declared by this type

#### getConstructor

    public Constructor getConstructor(AjType<?>... parameterTypes)
                               throws NoSuchMethodException

Specified by:
  `getConstructor` in interface `AjType<T>`
Parameters:
  `parameterTypes` - the types of the constructor parameters
Returns:
  the constructor object for the specified public constructor of this type
Throws:
  `NoSuchMethodException` - if constructor not found

#### getConstructors

    public Constructor[] getConstructors()

Specified by:
  `getConstructors` in interface `AjType<T>`
Returns:
  all of the public constructors of this type

#### getDeclaredConstructor

    public Constructor getDeclaredConstructor(AjType<?>... parameterTypes)
                                       throws NoSuchMethodException

Specified by:
  `getDeclaredConstructor` in interface `AjType<T>`
Parameters:
  `parameterTypes` - the types of the constructor parameters
Returns:
  the constructor object for the specified constructor of this type
Throws:
  `NoSuchMethodException` - if constructor not found

#### getDeclaredConstructors

    public Constructor[] getDeclaredConstructors()

Specified by:
  `getDeclaredConstructors` in interface `AjType<T>`
Returns:
  all the constructors declared in this type

#### getDeclaredField

    public Field getDeclaredField(String name)
                           throws NoSuchFieldException

Specified by:
  `getDeclaredField` in interface `AjType<T>`
Parameters:
  `name` - the field name
Returns:
  the declared field
Throws:
  `NoSuchFieldException` - if no field of that name is found

#### getDeclaredFields

    public Field[] getDeclaredFields()

Specified by:
  `getDeclaredFields` in interface `AjType<T>`
Returns:
  all the fields declared in this type

#### getField

    public Field getField(String name)
                   throws NoSuchFieldException

Specified by:
  `getField` in interface `AjType<T>`
Parameters:
  `name` - the field name
Returns:
  the public field with the given name
Throws:
  `NoSuchFieldException` - if field not found

#### getFields

    public Field[] getFields()

Specified by:
  `getFields` in interface `AjType<T>`
Returns:
  the public fields declared by this type

#### getDeclaredMethod

    public Method getDeclaredMethod(String name,
                                    AjType<?>... parameterTypes)
                             throws NoSuchMethodException

Specified by:
  `getDeclaredMethod` in interface `AjType<T>`
Parameters:
  `name` - the method name
  `parameterTypes` - the types of the method parameters
Returns:
  the method object for the specified method declared in this type
Throws:
  `NoSuchMethodException` - if the method cannot be found

#### getMethod

    public Method getMethod(String name,
                            AjType<?>... parameterTypes)
                     throws NoSuchMethodException

Specified by:
  `getMethod` in interface `AjType<T>`
Parameters:
  `name` - the method name
  `parameterTypes` - the types of the method parameters
Returns:
  the method object for the specified public method declared in this type
Throws:
  `NoSuchMethodException` - if the method cannot be found

#### getDeclaredMethods

    public Method[] getDeclaredMethods()

Specified by:
  `getDeclaredMethods` in interface `AjType<T>`
Returns:
  all the methods declared by this type

#### getMethods

    public Method[] getMethods()

Specified by:
  `getMethods` in interface `AjType<T>`
Returns:
  all the public methods of this type

#### getDeclaredPointcut

    public Pointcut getDeclaredPointcut(String name)
                                 throws NoSuchPointcutException

Specified by:
  `getDeclaredPointcut` in interface `AjType<T>`
Parameters:
  `name` - the pointcut name
Returns:
  the pointcut object representing the specified pointcut declared by this type
Throws:
  `NoSuchPointcutException` - if no pointcut of that name can be found

#### getPointcut

    public Pointcut getPointcut(String name)
                         throws NoSuchPointcutException

Specified by:
  `getPointcut` in interface `AjType<T>`
Parameters:
  `name` - the pointcut name
Returns:
  the pointcut object representing the specified public pointcut
Throws:
  `NoSuchPointcutException` - if no pointcut of that name can be found

#### getDeclaredPointcuts

    public Pointcut[] getDeclaredPointcuts()

Specified by:
  `getDeclaredPointcuts` in interface `AjType<T>`
Returns:
  all of the pointcuts declared by this type

#### getPointcuts

    public Pointcut[] getPointcuts()

Specified by:
  `getPointcuts` in interface `AjType<T>`
Returns:
  all of the public pointcuts of this type

#### getDeclaredAdvice

    public Advice[] getDeclaredAdvice(AdviceKind... ofType)

Specified by:
  `getDeclaredAdvice` in interface `AjType<T>`
Parameters:
  `ofType` - the `AdviceKind`s of interest
Returns:
  all of the advice declared by this type, of an advice kind contained in the parameter list.

#### getAdvice

    public Advice[] getAdvice(AdviceKind... ofType)

Specified by:
  `getAdvice` in interface `AjType<T>`
Parameters:
  `ofType` - the `AdviceKind`s of interest
Returns:
  all of the advice for this type, of an advice kind contained in the parameter list.

#### getAdvice

    public Advice getAdvice(String name)
                     throws NoSuchAdviceException

Description copied from interface: `AjType`
For an annotation style 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.

Specified by:
  `getAdvice` in interface `AjType<T>`
Parameters:
  `name` - the advice name
Returns:
  the advice with the given name.
Throws:
  `NoSuchAdviceException` - if no advice can be found with that name

#### getDeclaredAdvice

    public Advice getDeclaredAdvice(String name)
                             throws NoSuchAdviceException

Description copied from interface: `AjType`
For an annotation style 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.

Specified by:
  `getDeclaredAdvice` in interface `AjType<T>`
Parameters:
  `name` - the advice name
Returns:
  the advice declared in this type with the given name.
Throws:
  `NoSuchAdviceException` - if no advice can be found with that name

#### getDeclaredITDMethod

    public InterTypeMethodDeclaration getDeclaredITDMethod(String name,
                                                           AjType<?> target,
                                                           AjType<?>... parameterTypes)
                                                    throws NoSuchMethodException

Specified by:
  `getDeclaredITDMethod` in interface `AjType<T>`
Parameters:
  `name` - the method name
  `target` - the target of the inter-type declaration
  `parameterTypes` - the types of the inter-type method declaration
Returns:
  the inter-type method declared by this type matching the given specification
Throws:
  `NoSuchMethodException` - if the inter-type declaration cannot be found

#### getDeclaredITDMethods

    public InterTypeMethodDeclaration[] getDeclaredITDMethods()

Specified by:
  `getDeclaredITDMethods` in interface `AjType<T>`
Returns:
  all of the inter-type methods declared by this type

#### getITDMethod

    public InterTypeMethodDeclaration getITDMethod(String name,
                                                   AjType<?> target,
                                                   AjType<?>... parameterTypes)
                                            throws NoSuchMethodException

Specified by:
  `getITDMethod` in interface `AjType<T>`
Parameters:
  `name` - the method name
  `target` - the target of the inter-type declaration
  `parameterTypes` - the types of the inter-type method declaration
Returns:
  the public inter-type method of this type matching the given specification
Throws:
  `NoSuchMethodException` - if the inter-type declaration cannot be found

#### getITDMethods

    public InterTypeMethodDeclaration[] getITDMethods()

Specified by:
  `getITDMethods` in interface `AjType<T>`
Returns:
  all of the public inter-type declared methods of this type

#### getDeclaredITDConstructor

    public InterTypeConstructorDeclaration getDeclaredITDConstructor(AjType<?> target,
                                                                     AjType<?>... parameterTypes)
                                                              throws NoSuchMethodException

Specified by:
  `getDeclaredITDConstructor` in interface `AjType<T>`
Parameters:
  `target` - the target of the inter-type constructor of interest
  `parameterTypes` - the types of the parameter of the inter-type constructor of interest
Returns:
  the inter-type constructor declared by this type matching the given specification
Throws:
  `NoSuchMethodException` - if the inter-type declaration cannot be found

#### getDeclaredITDConstructors

    public InterTypeConstructorDeclaration[] getDeclaredITDConstructors()

Specified by:
  `getDeclaredITDConstructors` in interface `AjType<T>`
Returns:
  all of the inter-type constructors declared by this type

#### getITDConstructor

    public InterTypeConstructorDeclaration getITDConstructor(AjType<?> target,
                                                             AjType<?>... parameterTypes)
                                                      throws NoSuchMethodException

Specified by:
  `getITDConstructor` in interface `AjType<T>`
Parameters:
  `target` - the target of the inter-type constructor of interest
  `parameterTypes` - the types of the parameter of the inter-type constructor of interest
Returns:
  the public inter-type constructor matching the given specification
Throws:
  `NoSuchMethodException` - if the inter-type declaration cannot be found

#### getITDConstructors

    public InterTypeConstructorDeclaration[] getITDConstructors()

Specified by:
  `getITDConstructors` in interface `AjType<T>`
Returns:
  all of the public inter-type constructors of this type

#### getDeclaredITDField

    public InterTypeFieldDeclaration getDeclaredITDField(String name,
                                                         AjType<?> target)
                                                  throws NoSuchFieldException

Specified by:
  `getDeclaredITDField` in interface `AjType<T>`
Parameters:
  `name` - the field name
  `target` - the target type for the inter-type declaration
Returns:
  the inter-type field declared in this type with the given specification
Throws:
  `NoSuchFieldException` - if the inter-type declaration cannot be found

#### getDeclaredITDFields

    public InterTypeFieldDeclaration[] getDeclaredITDFields()

Specified by:
  `getDeclaredITDFields` in interface `AjType<T>`
Returns:
  all of the inter-type fields declared in this type

#### getITDField

    public InterTypeFieldDeclaration getITDField(String name,
                                                 AjType<?> target)
                                          throws NoSuchFieldException

Specified by:
  `getITDField` in interface `AjType<T>`
Parameters:
  `name` - the field name
  `target` - the target type for the inter-type declaration
Returns:
  the public inter-type field matching the given specification
Throws:
  `NoSuchFieldException` - if the inter-type declaration cannot be found

#### getITDFields

    public InterTypeFieldDeclaration[] getITDFields()

Specified by:
  `getITDFields` in interface `AjType<T>`
Returns:
  all of the public inter-type fields for this type

#### getDeclareErrorOrWarnings

    public DeclareErrorOrWarning[] getDeclareErrorOrWarnings()

Specified by:
  `getDeclareErrorOrWarnings` in interface `AjType<T>`
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()

Specified by:
  `getDeclareParents` in interface `AjType<T>`
Returns:
  all of the declare parents members of this type, including declare parent members inherited from super-types

#### getDeclareSofts

    public DeclareSoft[] getDeclareSofts()

Specified by:
  `getDeclareSofts` in interface `AjType<T>`
Returns:
  all of the declare soft members of this type, including declare soft members inherited from super-types

#### getDeclareAnnotations

    public DeclareAnnotation[] getDeclareAnnotations()

Specified by:
  `getDeclareAnnotations` in interface `AjType<T>`
Returns:
  all of the declare annotation members of this type, including declare annotation members inherited from super-types

#### getDeclarePrecedence

    public DeclarePrecedence[] getDeclarePrecedence()

Specified by:
  `getDeclarePrecedence` in interface `AjType<T>`
Returns:
  all of the declare precedence members of this type, including declare precedence members inherited from super-types

#### getEnumConstants

    public T[] getEnumConstants()

Specified by:
  `getEnumConstants` in interface `AjType<T>`
Returns:
  the elements of this enum class, or null if this type does not represent an enum type.

#### getTypeParameters

    public TypeVariable<Class<T>>[] getTypeParameters()

Specified by:
  `getTypeParameters` in interface `AjType<T>`
Returns:
  an array of TypeVariable objects that represent the type variables declared by this type (if any)

#### isEnum

    public boolean isEnum()

Specified by:
  `isEnum` in interface `AjType<T>`
Returns:
  true if this is an enum type

#### isInstance

    public boolean isInstance(Object o)

Specified by:
  `isInstance` in interface `AjType<T>`
Parameters:
  `o` - the object to check for assignment compatibility
Returns:
  true if the given object is assignment-compatible with an object of the type represented by this AjType

#### isInterface

    public boolean isInterface()

Specified by:
  `isInterface` in interface `AjType<T>`
Returns:
  true if this is an interface type

#### isLocalClass

    public boolean isLocalClass()

Specified by:
  `isLocalClass` in interface `AjType<T>`
Returns:
  true if and only if the underlying type is a local class

#### isMemberClass

    public boolean isMemberClass()

Specified by:
  `isMemberClass` in interface `AjType<T>`
Returns:
  true if and only if the underlying type is a member class

#### isArray

    public boolean isArray()

Specified by:
  `isArray` in interface `AjType<T>`
Returns:
  true if this is an array type

#### isPrimitive

    public boolean isPrimitive()

Specified by:
  `isPrimitive` in interface `AjType<T>`
Returns:
  true if this object represents a primitive type

#### isAspect

    public boolean isAspect()

Specified by:
  `isAspect` in interface `AjType<T>`
Returns:
  true if this is an aspect type

#### isMemberAspect

    public boolean isMemberAspect()

Specified by:
  `isMemberAspect` in interface `AjType<T>`
Returns:
  true if and only if the underlying type is a member aspect

#### isPrivileged

    public boolean isPrivileged()

Specified by:
  `isPrivileged` in interface `AjType<T>`
Returns:
  true if and only if the underlying type is a privileged aspect

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`