@Override public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Type type) { BindPojo bind = (BindPojo) annotation; return (stmt, bean) -> { String prefix = bind.value(); if (prefix.isEmpty()) { stmt.bindPojo(bean); } else { stmt.bindPojo(prefix, bean); } }; } }
/** * Binds named parameters from object properties on the argument. * The type must have been registered with pojo type mapping functionality first, usually * by a plugin or configuration. * * @param pojo source of named parameter values to use as arguments * * @return modified statement * @see JdbiImmutables an example method of registering a type */ @Beta public This bindPojo(Object pojo) { return bindPojo(null, pojo); }