Class DbClient.Builder

    • Method Detail

      • build

        public DbClient build()
        Build provider specific database handler.
        Specified by:
        build in interface Builder<DbClient>
        Returns:
        new database handler instance
      • addInterceptor

        public DbClient.Builder addInterceptor​(DbInterceptor interceptor)
        Add a global interceptor. A global interceptor is applied to each statement.
        Parameters:
        interceptor - interceptor to apply
        Returns:
        updated builder instance
      • addInterceptor

        public DbClient.Builder addInterceptor​(DbInterceptor interceptor,
                                               String... statementNames)
        Add an interceptor to specific named statements.
        Parameters:
        interceptor - interceptor to apply
        statementNames - names of statements to apply it on
        Returns:
        updated builder instance
      • addInterceptor

        public DbClient.Builder addInterceptor​(DbInterceptor interceptor,
                                               DbStatementType... dbStatementTypes)
        Add an interceptor to specific statement types.
        Parameters:
        interceptor - interceptor to apply
        dbStatementTypes - types of statements to apply it on
        Returns:
        updated builder instance
      • config

        public DbClient.Builder config​(Config config)
        Use database connection configuration from configuration file.
        Parameters:
        config - Config instance with database connection attributes
        Returns:
        database provider builder
      • statements

        public DbClient.Builder statements​(DbStatements statements)
        Statements to use either from configuration or manually configured.
        Parameters:
        statements - Statements to use
        Returns:
        updated builder instance
      • mapperProvider

        public DbClient.Builder mapperProvider​(DbMapperProvider provider)
        Database schema mappers provider. Mappers associated with types in this provider will override existing types associations loaded as DbMapperProvider Java services.
        Parameters:
        provider - database schema mappers provider to use
        Returns:
        updated builder instance
      • mapperManager

        public DbClient.Builder mapperManager​(MapperManager manager)
        Mapper manager for generic mapping, such as mapping of parameters to expected types.
        Parameters:
        manager - mapper manager
        Returns:
        updated builder instance