Class AJExtender


  • public class AJExtender
    extends java.lang.Object
    Static utility used for aspectJ extension consistency , routing and for maintaining thread-local extension-bypass context stack.
    AspectJ extension routing distinguishes between the following contexts in which an extended method (i.e. a method with an Extend annotation) can be called:
    1. Extend context
      when an extended method is called and the extension overrides the method call
    2. Local proceed context
      when an extension method needs to execute the original method that it has overridden.
    3. Extension bypass context
      when a call to an extended method needs to be completed with the extensions disabled for that call

    The AJExtender can check ExtensionPoint definitions for consistency by compiling extensible classes. The compilation process fails if there are inconsistencies between ExtensionPoints and Extend annotated methods (egg. an annotated method can not be mapped to a method in the indicated extension by signature matching).
    Author:
    Bogdan Horje
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  AJExtender.ExtensionBypass<R>
      Implementors are aspectJ extension ignoring closures.
    • Constructor Summary

      Constructors 
      Constructor Description
      AJExtender()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <R> R run​(AJExtender.ExtensionBypass<R> closure)
      Extension-bypass closure runner method.
      static <R> R run​(AJExtender.ExtensionBypass<R> closure, java.lang.Class<?>[] exTypes)
      Extension-bypass closure runner method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AJExtender

        public AJExtender()
    • Method Detail

      • run

        public static <R> R run​(AJExtender.ExtensionBypass<R> closure,
                                java.lang.Class<?>[] exTypes)
                         throws java.lang.Throwable
        Extension-bypass closure runner method.
        Sets up adequate call contexts to avoid exception calling and than delegates to the given closure.
        Only the given exTypes exceptions will be passed on to the calling context, all others will be wrapped as UndeclaredThrowableExceptions.
        Parameters:
        closure -
        exTypes -
        Returns:
        Throws:
        java.lang.Throwable
      • run

        public static <R> R run​(AJExtender.ExtensionBypass<R> closure)
        Extension-bypass closure runner method.
        Sets up adequate call contexts to avoid exception calling and than delegates to the given closure.
        Parameters:
        closure -
        Returns: