Class Extensions

java.lang.Object
org.jdbi.v3.core.extension.Extensions
All Implemented Interfaces:
JdbiConfig<Extensions>

public class Extensions extends Object implements JdbiConfig<Extensions>
Configuration class for defining Jdbi extensions via ExtensionFactory instances.
  • Constructor Details

    • Extensions

      public Extensions()
      Create an empty ExtensionFactory configuration.
  • Method Details

    • register

      public Extensions register(ExtensionFactory factory)
      Register an extension factory.
      Parameters:
      factory - the factory to register
      Returns:
      this
    • hasExtensionFor

      public boolean hasExtensionFor(Class<?> extensionType)
      Parameters:
      extensionType - the type to query
      Returns:
      true if a registered extension handles the type
    • findFor

      public <E> Optional<E> findFor(Class<E> extensionType, HandleSupplier handle)
      Create an extension instance if we have a factory that understands the extension type which has access to a Handle through a HandleSupplier.
      Type Parameters:
      E - the extension type to create
      Parameters:
      extensionType - the extension type to create
      handle - the handle supplier
      Returns:
      an attached extension instance if a factory is found
    • findFactory

      public <F extends ExtensionFactory> Optional<F> findFactory(Class<F> factoryType)
      Find the registered factory of the given type, if any
      Type Parameters:
      F - the factory type to find
      Parameters:
      factoryType - the factory's type to find
      Returns:
      the found factory, if any
    • setAllowProxy

      @Beta public Extensions setAllowProxy(boolean allowProxy)
      Allow using Proxy to implement extensions.
      Parameters:
      allowProxy - whether to allow use of Proxy types
      Returns:
      this
    • isAllowProxy

      @Beta public boolean isAllowProxy()
      Returns:
      whether Proxy classes are allowed to be used
    • createCopy

      public Extensions createCopy()
      Description copied from interface: JdbiConfig
      Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.
      Specified by:
      createCopy in interface JdbiConfig<Extensions>
      Returns:
      a copy of this configuration object.
    • onCreateProxy

      @Beta public void onCreateProxy()
      Throw if proxy creation is disallowed.