Search in sources :

Example 1 with RegisterCollectorFactory

use of org.jdbi.v3.sqlobject.config.RegisterCollectorFactory in project jdbi by jdbi.

the class RegisterCollectorFactoryImpl method configureForType.

@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
    RegisterCollectorFactory registerCollectorFactory = (RegisterCollectorFactory) annotation;
    JdbiCollectors collectors = registry.get(JdbiCollectors.class);
    Class<? extends CollectorFactory> type = registerCollectorFactory.value();
    try {
        collectors.register(type.newInstance());
    } catch (InstantiationException | IllegalAccessException e) {
        throw new IllegalStateException("Unable to instantiate container factory", e);
    }
}
Also used : RegisterCollectorFactory(org.jdbi.v3.sqlobject.config.RegisterCollectorFactory) JdbiCollectors(org.jdbi.v3.core.collector.JdbiCollectors)

Aggregations

JdbiCollectors (org.jdbi.v3.core.collector.JdbiCollectors)1 RegisterCollectorFactory (org.jdbi.v3.sqlobject.config.RegisterCollectorFactory)1