use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.
the class RegisterColumnMapperFactoryImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
RegisterColumnMapperFactory registerColumnMapperFactory = (RegisterColumnMapperFactory) annotation;
try {
ColumnMapperFactory factory = registerColumnMapperFactory.value().newInstance();
registry.get(ColumnMappers.class).register(factory);
} catch (Exception e) {
throw new IllegalStateException("unable to create a specified column mapper factory", e);
}
}
use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.
the class RegisterFieldMapperImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
RegisterFieldMapper registerFieldMapper = (RegisterFieldMapper) annotation;
Class<?> type = registerFieldMapper.value();
String prefix = registerFieldMapper.prefix();
RowMappers mappers = registry.get(RowMappers.class);
if (prefix.isEmpty()) {
mappers.register(FieldMapper.factory(type));
} else {
mappers.register(FieldMapper.factory(type, prefix));
}
}
use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.
the class RegisterFieldMappersImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
Configurer delegate = new RegisterFieldMapperImpl();
RegisterFieldMappers registerFieldMappers = (RegisterFieldMappers) annotation;
Stream.of(registerFieldMappers.value()).forEach(anno -> delegate.configureForType(registry, anno, sqlObjectType));
}
use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.
the class RegisterObjectArgumentFactoriesImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
Configurer delegate = new RegisterObjectArgumentFactoryImpl();
RegisterObjectArgumentFactories registerObjectArgumentFactories = (RegisterObjectArgumentFactories) annotation;
Stream.of(registerObjectArgumentFactories.value()).forEach(anno -> delegate.configureForType(registry, anno, sqlObjectType));
}
use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.
the class RegisterObjectArgumentFactoryImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
RegisterObjectArgumentFactory registerObjectArgumentFactory = (RegisterObjectArgumentFactory) annotation;
Arguments arguments = registry.get(Arguments.class);
Class<?> clazz = registerObjectArgumentFactory.value();
int sqlType = registerObjectArgumentFactory.sqlType();
if (sqlType == Integer.MIN_VALUE) {
arguments.register(ObjectArgumentFactory.create(clazz));
} else {
arguments.register(ObjectArgumentFactory.create(clazz, sqlType));
}
}
Aggregations