@OverrideStatementLocatorWith(StringTemplate3StatementLocator.class) static interface Kangaroo { @SqlUpdate public void insert(@BindBean Something s); @SqlQuery public Something findById(@Bind("id") Long id); @SqlQuery("select name from something where id = :it") String findNameFor(@Bind int id); @SqlUpdate void weirdInsert(@Define("table") String table, @Define("id_column") String idColumn, @Define("value_column") String valueColumn, @Bind("id") int id, @Bind("value") String name); }
@Override public SqlStatementCustomizer createForType(Annotation annotation, Class sqlObjectType) { OverrideStatementLocatorWith sl = (OverrideStatementLocatorWith) annotation; final StatementLocator f; try { f = instantiate(sl.value(), sqlObjectType, null); } catch (Exception e) { throw new IllegalStateException("unable to instantiate a statement locator", e); } return new SqlStatementCustomizer() { @Override public void apply(SQLStatement q) { q.setStatementLocator(f); } }; }
public SqlStatementCustomizer createForMethod(Annotation annotation, Class sqlObjectType, Method method) { OverrideStatementLocatorWith sl = (OverrideStatementLocatorWith) annotation; final org.skife.jdbi.v2.tweak.StatementLocator f; try { f = instantiate(sl.value(), sqlObjectType, method); } catch (Exception e) { throw new IllegalStateException("unable to instantiate a statement locator", e); } return new SqlStatementCustomizer() { public void apply(SQLStatement q) { q.setStatementLocator(f); } }; }
@OverrideStatementLocatorWith(StringTemplate3StatementLocator.class) @RegisterMapper(SomethingMapper.class) static interface Kangaroo { @SqlUpdate public void insert(@BindBean Something s); @SqlQuery public Something findById(@Bind("id") Long id); @SqlQuery("select name from something where id = :it") String findNameFor(@Bind int id); @SqlUpdate void weirdInsert(@Define("table") String table, @Define("id_column") String idColumn, @Define("value_column") String valueColumn, @Bind("id") int id, @Bind("value") String name); }
public SqlStatementCustomizer createForType(Annotation annotation, Class sqlObjectType) { OverrideStatementLocatorWith sl = (OverrideStatementLocatorWith) annotation; final StatementLocator f; try { f = instantiate(sl.value(), sqlObjectType, null); } catch (Exception e) { throw new IllegalStateException("unable to instantiate a statement locator", e); } return new SqlStatementCustomizer() { public void apply(SQLStatement q) { q.setStatementLocator(f); } }; }
@Override public SqlStatementCustomizer createForMethod(Annotation annotation, Class sqlObjectType, Method method) { OverrideStatementLocatorWith sl = (OverrideStatementLocatorWith) annotation; final org.skife.jdbi.v2.tweak.StatementLocator f; try { f = instantiate(sl.value(), sqlObjectType, method); } catch (Exception e) { throw new IllegalStateException("unable to instantiate a statement locator", e); } return new SqlStatementCustomizer() { @Override public void apply(SQLStatement q) { q.setStatementLocator(f); } }; }