Interface GeneratedSqlObjectProvider


@Alpha public interface GeneratedSqlObjectProvider
Connects a GenerateSqlObject type to the classes that the Jdbi generator created for it.

The generator writes an implementation of this interface next to each generated class and registers it through ServiceLoader. Jdbi uses the provider to create instances and to learn the extension methods without reflection, so generated SQL objects work in a GraalVM native image without reachability metadata. Application code does not implement this interface.

Since:
3.55.0
  • Method Details

    • extensionType

      Class<?> extensionType()
      Returns the extension type that this provider serves.
      Returns:
      The extension type, annotated with GenerateSqlObject
    • extensionMethods

      Collection<Method> extensionMethods()
      Returns the methods of the extension type that the generated class implements.
      Returns:
      The extension methods
    • createInstance

      Object createInstance(ExtensionMetadata extensionMetadata, HandleSupplier handleSupplier, ConfigRegistry config)
      Creates a new instance of the generated class, bound to a handle.
      Parameters:
      extensionMetadata - The metadata for the extension type
      handleSupplier - The handle supplier for the new instance
      config - The configuration for the new instance
      Returns:
      A new instance of the extension type
    • createOnDemand

      Object createOnDemand(Jdbi jdbi)
      Creates a new on-demand instance of the extension type.
      Parameters:
      jdbi - The Jdbi instance that supplies handles
      Returns:
      A new on-demand instance of the extension type