public class Aspects
extends java.lang.Object
Constructor and Description |
---|
Aspects() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
aspectOf(java.lang.Class<T> aspectClass) |
static <T> T |
aspectOf(java.lang.Class<T> aspectClass,
java.lang.Class<?> perTypeWithin) |
static <T> T |
aspectOf(java.lang.Class<T> aspectClass,
java.lang.Object perObject) |
static boolean |
hasAspect(java.lang.Class<?> aspectClass) |
static boolean |
hasAspect(java.lang.Class<?> aspectClass,
java.lang.Class<?> perTypeWithin) |
static boolean |
hasAspect(java.lang.Class<?> aspectClass,
java.lang.Object perObject) |
public static <T> T aspectOf(java.lang.Class<T> aspectClass) throws NoAspectBoundException
T
- the expected class of the aspectaspectClass
- the aspect classNoAspectBoundException
- if no such aspectpublic static <T> T aspectOf(java.lang.Class<T> aspectClass, java.lang.Object perObject) throws NoAspectBoundException
T
- the expected class of the aspectaspectClass
- the aspect classperObject
- the this/target object for which to look for an aspect instanceNoAspectBoundException
- if no such aspect, or no aspect boundpublic static <T> T aspectOf(java.lang.Class<T> aspectClass, java.lang.Class<?> perTypeWithin) throws NoAspectBoundException
T
- the expected class of the aspectaspectClass
- the aspect classperTypeWithin
- the class for which to search for an aspect instanceNoAspectBoundException
- if no such aspect, or no aspect boundpublic static boolean hasAspect(java.lang.Class<?> aspectClass) throws NoAspectBoundException
aspectClass
- the aspect classNoAspectBoundException
- if not boundpublic static boolean hasAspect(java.lang.Class<?> aspectClass, java.lang.Object perObject) throws NoAspectBoundException
aspectClass
- the aspect classperObject
- the this/target object for which to look for an aspect instanceNoAspectBoundException
- if not boundpublic static boolean hasAspect(java.lang.Class<?> aspectClass, java.lang.Class<?> perTypeWithin) throws NoAspectBoundException
aspectClass
- the aspect classperTypeWithin
- classNoAspectBoundException
- if not bound