Package org.skife.jdbi.unstable.decorator

Provides facilities for decorating Handles, and possible other interfaces eventually (if you need that, let us know!).

See:
          Description

Interface Summary
HandleDecoratorBuilder Used to decorate Handle instances obtained from a DBI instance.
 

Class Summary
BaseHandleDecorator Convenience class implementing Handle which delegates all method calls to the Handle instance passed into its constructor.
 

Package org.skife.jdbi.unstable.decorator Description

Provides facilities for decorating Handles, and possible other interfaces eventually (if you need that, let us know!).

To use a handle decorator provide an instance of HandleDecoratorBuilder and register it via DBI#setHandleDecoratorBuilder(..). This will cause all Handle instances obtained via the DBI to be decorated via the decorated created by the builder.


        final DBI dbi = new DBI(Tools.CONN_STRING);
        dbi.setHandleDecoratorBuilder(new MyHandleDecoratorBuilder());
        final Handle h = dbi.open();

Decorators can also be added via auto-configuration by specifying a class name of a class implementing the HandleDecoratorBuilder interface, which provides a no-argument constructor under the property jdbi.handle-decorator-builder.


jdbi.handle-decorator-builder=org.skife.jdbi.MyHandleDecoratorBuilder

Finally, the Spring DBIBean supports setting handle decorator builder via the handleDecoratorBuilder property, and might be used as follows:


    <bean id="dbi" class="org.skife.jdbi.spring.DBIBean">
        <property name="dataSource"><ref bean="dataSource" /></property>
        <property name="handleDecoratorBuilder">
            <bean class="org.skife.jdbi.MyHandleDecoratorBuilder"/>
        </property>
    </bean>