Class InterceptionUtilities

java.lang.Object
org.tentackle.reflect.InterceptionUtilities

@Service(InterceptionUtilities.class) public class InterceptionUtilities extends Object
Utility methods for interception handling.
Author:
harald
  • Constructor Details

    • InterceptionUtilities

      public InterceptionUtilities()
      Creates the interception utilities.
  • Method Details

    • getInstance

      public static InterceptionUtilities getInstance()
      The singleton.
      Returns:
      the singleton
    • findInterceptors

      public Interceptor findInterceptors(Class<?> clazz, Method method, Method implMethod)
      Finds all interceptors of a method.
      Parameters:
      clazz - the interface which the interface the method is declared in extends
      method - the interface method
      implMethod - the implementing class method
      Returns:
      the head of interceptors, null if not intercepted
    • createInterceptableMethod

      public InterceptableMethod createInterceptableMethod(Class<? extends Interceptable> clazz, Class<? extends Interceptable> delegateClazz, Method method)
      Creates an interceptable method.

      Finds the implementing method of the delegate and optional interceptors.

      Parameters:
      clazz - the topmost interceptable interface
      delegateClazz - the delegate's class to invoke the method on
      method - the interface's method to invoke
      Returns:
      the interceptable method
    • findDeclaredMethod

      public Method findDeclaredMethod(Class<?> clazz, Method method)
      Finds the declared interface method for a given method signature.
      This usually indicates that the invocation handler is not servicing the expected interface.
      The default implementation just logs the fact that something is weird and returns the passed method.
      Parameters:
      clazz - the top-level interface serviced by the invocation handler
      method - the invoked interface method
      Returns:
      the effective interface method to scan for public interceptors