Class AJExtender


  • public class AJExtender
    extends 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
    • Constructor Detail

      • AJExtender

        public AJExtender()
    • Method Detail

      • run

        public static <R> R run​(AJExtender.ExtensionBypass<R> closure,
                                Class<?>[] exTypes)
                         throws 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:
        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: