Search in sources :

Example 6 with ConfigRegistry

use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.

the class RegisterConstructorMappersImpl method configureForType.

@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
    Configurer delegate = new RegisterConstructorMapperImpl();
    RegisterConstructorMappers registerConstructorMappers = (RegisterConstructorMappers) annotation;
    Stream.of(registerConstructorMappers.value()).forEach(anno -> delegate.configureForType(registry, anno, sqlObjectType));
}
Also used : RegisterConstructorMappers(org.jdbi.v3.sqlobject.config.RegisterConstructorMappers) Configurer(org.jdbi.v3.sqlobject.config.Configurer)

Example 7 with ConfigRegistry

use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.

the class RegisterJoinRowMapperImpl method configureForType.

@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
    RegisterJoinRowMapper registerJoinRowMapper = (RegisterJoinRowMapper) annotation;
    registry.get(RowMappers.class).register(JoinRowMapper.forTypes(registerJoinRowMapper.value()));
}
Also used : RegisterJoinRowMapper(org.jdbi.v3.sqlobject.config.RegisterJoinRowMapper) RowMappers(org.jdbi.v3.core.mapper.RowMappers)

Example 8 with ConfigRegistry

use of org.jdbi.v3.core.config.ConfigRegistry 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);
    }
}
Also used : RowMappers(org.jdbi.v3.core.mapper.RowMappers) RegisterRowMapperFactory(org.jdbi.v3.sqlobject.config.RegisterRowMapperFactory)

Example 9 with ConfigRegistry

use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.

the class RegisterRowMappersImpl method configureForType.

@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
    Configurer delegate = new RegisterRowMapperImpl();
    RegisterRowMappers registerRowMappers = (RegisterRowMappers) annotation;
    Stream.of(registerRowMappers.value()).forEach(anno -> delegate.configureForType(registry, anno, sqlObjectType));
}
Also used : RegisterRowMappers(org.jdbi.v3.sqlobject.config.RegisterRowMappers) Configurer(org.jdbi.v3.sqlobject.config.Configurer)

Example 10 with ConfigRegistry

use of org.jdbi.v3.core.config.ConfigRegistry in project jdbi by jdbi.

the class UseSqlParserImpl method configureForType.

@Override
public void configureForType(ConfigRegistry registry, Annotation annotation, Class<?> sqlObjectType) {
    UseSqlParser anno = (UseSqlParser) annotation;
    try {
        final SqlParser parser = instantiate(anno.value(), sqlObjectType, null);
        registry.get(SqlStatements.class).setSqlParser(parser);
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
Also used : UseSqlParser(org.jdbi.v3.sqlobject.config.UseSqlParser) SqlStatements(org.jdbi.v3.core.statement.SqlStatements) SqlParser(org.jdbi.v3.core.statement.SqlParser) UseSqlParser(org.jdbi.v3.sqlobject.config.UseSqlParser)

Aggregations

Configurer (org.jdbi.v3.sqlobject.config.Configurer)10 ConfigRegistry (org.jdbi.v3.core.config.ConfigRegistry)8 RowMappers (org.jdbi.v3.core.mapper.RowMappers)5 SqlStatements (org.jdbi.v3.core.statement.SqlStatements)5 ColumnMappers (org.jdbi.v3.core.mapper.ColumnMappers)4 Type (java.lang.reflect.Type)3 Optional (java.util.Optional)3 ExtensionMethod (org.jdbi.v3.core.extension.ExtensionMethod)3 TemplateEngine (org.jdbi.v3.core.statement.TemplateEngine)3 Method (java.lang.reflect.Method)2 Types (java.sql.Types)2 Argument (org.jdbi.v3.core.argument.Argument)2 Arguments (org.jdbi.v3.core.argument.Arguments)2 JdbiCollectors (org.jdbi.v3.core.collector.JdbiCollectors)2 GenericTypes (org.jdbi.v3.core.generic.GenericTypes)2 ColumnMapperFactory (org.jdbi.v3.core.mapper.ColumnMapperFactory)2 MapEntryMappers (org.jdbi.v3.core.mapper.MapEntryMappers)2 SqlParser (org.jdbi.v3.core.statement.SqlParser)2 UseSqlParser (org.jdbi.v3.sqlobject.config.UseSqlParser)2 UseTemplateEngine (org.jdbi.v3.sqlobject.config.UseTemplateEngine)2