Class InstanceExtensionHandlerFactory

java.lang.Object
org.jdbi.v3.core.extension.InstanceExtensionHandlerFactory
All Implemented Interfaces:
ExtensionHandlerFactory

final class InstanceExtensionHandlerFactory extends Object implements ExtensionHandlerFactory
Provides ExtensionHandler instances for all methods that have not been covered in any other way. It forwards a call to the handler to a method invocation on the target object. For any extension factory that simply provides an implementation of the extension interface, this forwards the call to the method on the implementation. The extension framework wraps these calls into invocations that manage the extension context for the handle correctly so that logging will work for all extension.
  • Field Details

  • Constructor Details

    • InstanceExtensionHandlerFactory

      InstanceExtensionHandlerFactory()
  • Method Details

    • accepts

      public boolean accepts(Class<?> extensionType, Method method)
      Description copied from interface: ExtensionHandlerFactory
      Determines whether the factory can create an ExtensionHandler for combination of extension type and method.
      Specified by:
      accepts in interface ExtensionHandlerFactory
      Parameters:
      extensionType - The extension type class
      method - A method
      Returns:
      True if the factory can create an extension handler for extension type and method, false otherwise
    • createExtensionHandler

      public Optional<ExtensionHandler> createExtensionHandler(Class<?> extensionType, Method method)
      Description copied from interface: ExtensionHandlerFactory
      Returns an ExtensionHandler instance for a extension type and method combination.
      Specified by:
      createExtensionHandler in interface ExtensionHandlerFactory
      Parameters:
      extensionType - The extension type class
      method - A method
      Returns:
      An ExtensionHandler instance wrapped into an Optional. The optional can be empty. This is necessary to retrofit old code that does not have an accept/build code pair but unconditionally tries to build a handler and returns empty if it can not. New code should always return Optional.of(extensionHandler} and never return Optional.empty()