3

Currently I am upgrading from JDBI2 to JDBI3 but it doesn't seem like there is an obvious translation for BinderFactory and it isn't mentioned in the upgrade docs.

import org.skife.jdbi.v2.sqlobject.Binder;
import org.skife.jdbi.v2.sqlobject.BinderFactory;
import org.skife.jdbi.v2.sqlobject.BindingAnnotation;

@BindingAnnotation(LoadTypeBinder.LoadTypeBinderFactory.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface LoadTypeBinder {

    /**
     * Value.
     *
     * @return
     */
    String value() default "it";

    class LoadTypeBinderFactory implements BinderFactory {

        @Override
        public Binder build(Annotation annotation) {
            return (Binder<LoadTypeBinder, SolrDbDao.LoadType>)
                (q, bind, arg) -> q.bind(bind.value(), arg.value());
        }
    }
}
Ryan Mavilia
  • 63
  • 1
  • 4

0 Answers0