Top Description Fields Constructors Methods
org.aspectj.lang

public Class Aspects14

extends Object
Class Inheritance
Imports
java.lang.reflect.InvocationTargetException, .Method, .Modifier

For users working on a level of Java prior to Java5, Aspects14 handles generic aspectOf methods when they are not available in the aspects but added later on through load time weaving. Users on Java5 should use the class Aspects instead. Aspects14.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.

Field Summary

Modifier and TypeField and Description
private static final String
private static final Class<T>[]
private static final Object[]
private static final String
private static final Class<T>[]
private static final Class<T>[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Object

Returns:

an aspect instance
aspectOf
(Class<T>
aspect class for which to discover the aspect instance
aspectClass
)

Returns the singleton aspect or the percflow / percflowbelow associated with the current thread

public static Object

Returns:

an aspect instance
aspectOf
(Class<T>
aspect class for which to discover the aspect instance
aspectClass
,
Object
object for which to discover the aspect instance
perObject
)

Returns the perthis / pertarget aspect

public static Object

Returns:

the aspect instance
aspectOf
(Class<T>
aspect class for which to discover the aspect instance
aspectClass
,
Class<T>
class
perTypeWithin
)

Returns the pertypewithin aspect

private static Method
checkAspectOf(Method method, Class<?> aspectClass)

private static Method
checkHasAspect(Method method, Class<?> aspectClass)

private static Method
getPerObjectAspectOf(Class<?> aspectClass)

private static Method
getPerObjectHasAspect(Class<?> aspectClass)

private static Method
private static Method
private static Method
private static Method
public static boolean

Returns:

true if an aspect instance is bound
hasAspect
(Class<T>
aspect class for which to check the aspect instance
aspectClass
)

Returns true if singleton aspect or percflow / percflowbelow aspect is bound

public static boolean

Returns:

true if aspect instance exists for the class/object combination
hasAspect
(Class<T>
aspect class for which to check the aspect instance
aspectClass
,
Object
the this/target for which to check for an aspect
perObject
)

Returns true if the perthis / pertarget aspect is bound

public static boolean

Returns:

true if aspect instance exists for this aspect class/pertypewithin class combination
hasAspect
(Class<T>
aspect class for which to check the aspect instance
aspectClass
,
Class<T>
class
perTypeWithin
)

Returns true if the pertypewithin aspect is bound

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ASPECTOFback to summary
private static final String ASPECTOF
EMPTY_CLASS_ARRAYback to summary
private static final Class<T>[] EMPTY_CLASS_ARRAY
EMPTY_OBJECT_ARRAYback to summary
private static final Object[] EMPTY_OBJECT_ARRAY
HASASPECTback to summary
private static final String HASASPECT
PEROBJECT_CLASS_ARRAYback to summary
private static final Class<T>[] PEROBJECT_CLASS_ARRAY
PERTYPEWITHIN_CLASS_ARRAYback to summary
private static final Class<T>[] PERTYPEWITHIN_CLASS_ARRAY

Constructor Detail

Aspects14back to summary
public Aspects14()

Method Detail

aspectOfback to summary
public static Object aspectOf(Class<T> aspectClass) throws NoAspectBoundException

Returns the singleton aspect or the percflow / percflowbelow associated with the current thread

Parameters
aspectClass:Class<T>

aspect class for which to discover the aspect instance

Returns:Object

an aspect instance

Exceptions
NoAspectBoundException:
if no such aspect
aspectOfback to summary
public static Object aspectOf(Class<T> aspectClass, Object perObject) throws NoAspectBoundException

Returns the perthis / pertarget aspect

Parameters
aspectClass:Class<T>

aspect class for which to discover the aspect instance

perObject:Object

object for which to discover the aspect instance

Returns:Object

an aspect instance

Exceptions
NoAspectBoundException:
if no such aspect, or no aspect bound
aspectOfback to summary
public static Object aspectOf(Class<T> aspectClass, Class<T> perTypeWithin) throws NoAspectBoundException

Returns the pertypewithin aspect

Parameters
aspectClass:Class<T>

aspect class for which to discover the aspect instance

perTypeWithin:Class<T>

class

Returns:Object

the aspect instance

Exceptions
NoAspectBoundException:
if no such aspect, or no aspect bound
checkAspectOfback to summary
private static Method checkAspectOf(Method method, Class<?> aspectClass) throws NoSuchMethodException
checkHasAspectback to summary
private static Method checkHasAspect(Method method, Class<?> aspectClass) throws NoSuchMethodException
getPerObjectAspectOfback to summary
private static Method getPerObjectAspectOf(Class<?> aspectClass) throws NoSuchMethodException
getPerObjectHasAspectback to summary
private static Method getPerObjectHasAspect(Class<?> aspectClass) throws NoSuchMethodException
getPerTypeWithinAspectOfback to summary
private static Method getPerTypeWithinAspectOf(Class<?> aspectClass) throws NoSuchMethodException
getPerTypeWithinHasAspectback to summary
private static Method getPerTypeWithinHasAspect(Class<?> aspectClass) throws NoSuchMethodException
getSingletonOrThreadAspectOfback to summary
private static Method getSingletonOrThreadAspectOf(Class<?> aspectClass) throws NoSuchMethodException
getSingletonOrThreadHasAspectback to summary
private static Method getSingletonOrThreadHasAspect(Class<?> aspectClass) throws NoSuchMethodException
hasAspectback to summary
public static boolean hasAspect(Class<T> aspectClass) throws NoAspectBoundException

Returns true if singleton aspect or percflow / percflowbelow aspect is bound

Parameters
aspectClass:Class<T>

aspect class for which to check the aspect instance

Returns:boolean

true if an aspect instance is bound

Exceptions
NoAspectBoundException:
if not bound
hasAspectback to summary
public static boolean hasAspect(Class<T> aspectClass, Object perObject) throws NoAspectBoundException

Returns true if the perthis / pertarget aspect is bound

Parameters
aspectClass:Class<T>

aspect class for which to check the aspect instance

perObject:Object

the this/target for which to check for an aspect

Returns:boolean

true if aspect instance exists for the class/object combination

Exceptions
NoAspectBoundException:
if not bound
hasAspectback to summary
public static boolean hasAspect(Class<T> aspectClass, Class<T> perTypeWithin) throws NoAspectBoundException

Returns true if the pertypewithin aspect is bound

Parameters
aspectClass:Class<T>

aspect class for which to check the aspect instance

perTypeWithin:Class<T>

class

Returns:boolean

true if aspect instance exists for this aspect class/pertypewithin class combination

Exceptions
NoAspectBoundException:
if not bound