Search in sources :

Example 1 with RegisterObjectArgumentFactory

use of org.jdbi.v3.sqlobject.config.RegisterObjectArgumentFactory 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));
    }
}
Also used : Arguments(org.jdbi.v3.core.argument.Arguments) RegisterObjectArgumentFactory(org.jdbi.v3.sqlobject.config.RegisterObjectArgumentFactory)

Aggregations

Arguments (org.jdbi.v3.core.argument.Arguments)1 RegisterObjectArgumentFactory (org.jdbi.v3.sqlobject.config.RegisterObjectArgumentFactory)1