use of org.jdbi.v3.core.mapper.RowMappers in project jdbi by jdbi.
the class RegisterConstructorMapperImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
RegisterConstructorMapper registerConstructorMapper = (RegisterConstructorMapper) annotation;
RowMappers mappers = registry.get(RowMappers.class);
Class<?> type = registerConstructorMapper.value();
String prefix = registerConstructorMapper.prefix();
if (prefix.isEmpty()) {
mappers.register(ConstructorMapper.factory(type));
} else {
mappers.register(ConstructorMapper.factory(type, prefix));
}
}
use of org.jdbi.v3.core.mapper.RowMappers in project jdbi by jdbi.
the class RegisterRowMapperFactoryImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
RegisterRowMapperFactory registerRowMapperFactory = (RegisterRowMapperFactory) annotation;
RowMappers mappers = registry.get(RowMappers.class);
try {
mappers.register(registerRowMapperFactory.value().newInstance());
} catch (Exception e) {
throw new IllegalStateException("unable to create a specified row mapper factory", e);
}
}
use of org.jdbi.v3.core.mapper.RowMappers 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.mapper.RowMappers in project jdbi by jdbi.
the class RegisterBeanMapperImpl method configureForType.
@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
RegisterBeanMapper registerBeanMapper = (RegisterBeanMapper) annotation;
Class<?> beanClass = registerBeanMapper.value();
String prefix = registerBeanMapper.prefix();
RowMappers mappers = registry.get(RowMappers.class);
if (prefix.isEmpty()) {
mappers.register(BeanMapper.factory(beanClass));
} else {
mappers.register(BeanMapper.factory(beanClass, prefix));
}
}
Aggregations