Klasse 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.
Autor:
Alexandre Vasseur
  • Konstruktordetails

    • Aspects

      public Aspects()
  • Methodendetails

    • aspectOf

      public static <T> T aspectOf(Class<T> aspectClass) throws NoAspectBoundException
      Typparameter:
      T - the expected class of the aspect
      Parameter:
      aspectClass - the aspect class
      Gibt zurück:
      the singleton aspect or the percflow / percflowbelow associated with the current thread
      Löst aus:
      NoAspectBoundException - if no such aspect
    • aspectOf

      public static <T> T aspectOf(Class<T> aspectClass, Object perObject) throws NoAspectBoundException
      Typparameter:
      T - the expected class of the aspect
      Parameter:
      aspectClass - the aspect class
      perObject - the this/target object for which to look for an aspect instance
      Gibt zurück:
      the associated perthis / pertarget aspect instance
      Löst aus:
      NoAspectBoundException - if no such aspect, or no aspect bound
    • aspectOf

      public static <T> T aspectOf(Class<T> aspectClass, Class<?> perTypeWithin) throws NoAspectBoundException
      Typparameter:
      T - the expected class of the aspect
      Parameter:
      aspectClass - the aspect class
      perTypeWithin - the class for which to search for an aspect instance
      Gibt zurück:
      the associated aspect instance
      Löst aus:
      NoAspectBoundException - if no such aspect, or no aspect bound
    • hasAspect

      public static boolean hasAspect(Class<?> aspectClass) throws NoAspectBoundException
      Parameter:
      aspectClass - the aspect class
      Gibt zurück:
      true if singleton aspect or percflow / percflowbelow aspect is bound
      Löst aus:
      NoAspectBoundException - if not bound
    • hasAspect

      public static boolean hasAspect(Class<?> aspectClass, Object perObject) throws NoAspectBoundException
      Parameter:
      aspectClass - the aspect class
      perObject - the this/target object for which to look for an aspect instance
      Gibt zurück:
      true if the perthis / pertarget aspect is bound
      Löst aus:
      NoAspectBoundException - if not bound
    • hasAspect

      public static boolean hasAspect(Class<?> aspectClass, Class<?> perTypeWithin) throws NoAspectBoundException
      Parameter:
      aspectClass - the aspect class
      perTypeWithin - class
      Gibt zurück:
      true if the pertypewithin aspect is bound
      Löst aus:
      NoAspectBoundException - if not bound