Class Extensions

    • Constructor Detail

      • Extensions

        public Extensions()
        Creates a new instance.
      • Extensions

        private Extensions​(Extensions that)
        Create an extension configuration by cloning another.
        Parameters:
        that - the configuration to clone
    • Method Detail

      • setRegistry

        public void setRegistry​(ConfigRegistry registry)
        Description copied from interface: JdbiConfig
        The registry will inject itself into the configuration object. This can be useful if you need to look up dependencies. You will get a new registry after being copied.
        Specified by:
        setRegistry in interface JdbiConfig<Extensions>
        Parameters:
        registry - the registry that owns this configuration object
      • hasExtensionFor

        public boolean hasExtensionFor​(java.lang.Class<?> extensionType)
        Returns true if an extension is registered for the given extension type.
        Parameters:
        extensionType - the type to query. Must not be null
        Returns:
        true if a registered extension factory handles the type
      • findFor

        public <E> java.util.Optional<E> findFor​(java.lang.Class<E> extensionType,
                                                 HandleSupplier handleSupplier)
        Create an extension instance if a factory accepts the extension type. This method requires access to a HandleSupplier, which is only useful either from within an extension implementation of inside the Jdbi code. It should rarely be called by user code.
        Type Parameters:
        E - the extension type to create
        Parameters:
        extensionType - the extension type to create
        handleSupplier - A handle supplier object
        Returns:
        an attached extension instance if a factory is found, Optional.empty() otherwise
      • findFactoryFor

        private java.util.Optional<ExtensionFactory> findFactoryFor​(java.lang.Class<?> extensionType)
      • findFactory

        public java.util.Optional<ExtensionFactory> findFactory​(java.lang.Class<? extends ExtensionFactory> factoryType)
        Find the registered factory of the given type. The factory returned from this call may not be the same instance that was registered with register(ExtensionFactory).
        Parameters:
        factoryType - the factory's type to find
        Returns:
        the found factory, if any or Optional.empty() otherwise
      • findMetadata

        @Alpha
        public ExtensionMetadata findMetadata​(java.lang.Class<?> extensionType,
                                              ExtensionFactory extensionFactory)
        Retrieves all extension metadata for a specific extension type.
        Parameters:
        extensionType - The extension type
        extensionFactory - The extension factory for this extension type
        Returns:
        A ExtensionMetadata object describing the extension handlers and customizers for this extension type
        Since:
        3.38.0
      • 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.
        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.