org.aspectj.lang

## Class Aspects

- java.lang.Object
- - org.aspectj.lang.Aspects

    public class Aspects
    extends Object

Handles generic aspectOf method when those are not available in the aspects but added later on thru load time weaving. Aspects.aspectOf(..) is doing reflective calls to the aspect aspectOf, so for better performance consider using ajc compilation of the aspects and using them as a binary dependancies in your project.

Author:
  Alexandre Vasseur

### Constructor Summary

Constructors
Constructor and Description
`Aspects()`

### Method Summary

All Methods Static Methods Concrete Methods
`static <T> T` `aspectOf(Class<T> aspectClass)`
`static <T> T` `aspectOf(Class<T> aspectClass, Class<?> perTypeWithin)`
`static <T> T` `aspectOf(Class<T> aspectClass, Object perObject)`
`static boolean` `hasAspect(Class<?> aspectClass)`
`static boolean` `hasAspect(Class<?> aspectClass, Class<?> perTypeWithin)`
`static boolean` `hasAspect(Class<?> aspectClass, Object perObject)`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Aspects

    public Aspects()

### Method Detail

#### aspectOf

    public static <T> T aspectOf(Class<T> aspectClass)
                          throws NoAspectBoundException

Type Parameters:
  `T` - the expected class of the aspect
Parameters:
  `aspectClass` - the aspect class
Returns:
  the singleton aspect or the percflow / percflowbelow associated with the current thread
Throws:
  `NoAspectBoundException` - if no such aspect

#### aspectOf

    public static <T> T aspectOf(Class<T> aspectClass,
                                 Object perObject)
                          throws NoAspectBoundException

Type Parameters:
  `T` - the expected class of the aspect
Parameters:
  `aspectClass` - the aspect class
  `perObject` - the this/target object for which to look for an aspect instance
Returns:
  the associated perthis / pertarget aspect instance
Throws:
  `NoAspectBoundException` - if no such aspect, or no aspect bound

#### aspectOf

    public static <T> T aspectOf(Class<T> aspectClass,
                                 Class<?> perTypeWithin)
                          throws NoAspectBoundException

Type Parameters:
  `T` - the expected class of the aspect
Parameters:
  `aspectClass` - the aspect class
  `perTypeWithin` - the class for which to search for an aspect instance
Returns:
  the associated aspect instance
Throws:
  `NoAspectBoundException` - if no such aspect, or no aspect bound

#### hasAspect

    public static boolean hasAspect(Class<?> aspectClass)
                             throws NoAspectBoundException

Parameters:
  `aspectClass` - the aspect class
Returns:
  true if singleton aspect or percflow / percflowbelow aspect is bound
Throws:
  `NoAspectBoundException` - if not bound

#### hasAspect

    public static boolean hasAspect(Class<?> aspectClass,
                                    Object perObject)
                             throws NoAspectBoundException

Parameters:
  `aspectClass` - the aspect class
  `perObject` - the this/target object for which to look for an aspect instance
Returns:
  true if the perthis / pertarget aspect is bound
Throws:
  `NoAspectBoundException` - if not bound

#### hasAspect

    public static boolean hasAspect(Class<?> aspectClass,
                                    Class<?> perTypeWithin)
                             throws NoAspectBoundException

Parameters:
  `aspectClass` - the aspect class
  `perTypeWithin` - class
Returns:
  true if the pertypewithin aspect is bound
Throws:
  `NoAspectBoundException` - if not bound