@Override public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Type type) { final BindBeanList bindBeanList = (BindBeanList) annotation; final String name = ParameterUtil.findParameterName(bindBeanList.value(), param) .orElseThrow(() -> new UnsupportedOperationException("A @BindBeanList parameter was not given a name, " + "and parameter name data is not present in the class file, for: " + param.getDeclaringExecutable() + "::" + param)); return (stmt, arg) -> { if (arg == null) { throw new IllegalArgumentException("argument is null; null was explicitly forbidden on BindBeanList"); } stmt.bindBeanList(name, IterableLike.toList(arg), Arrays.asList(bindBeanList.propertyNames())); }; }
@Override public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Type type) { final BindList bindList = (BindList) annotation; final String name = ParameterUtil.findParameterName(bindList.value(), param) .orElseThrow(() -> new UnsupportedOperationException("A @BindList parameter was not given a name, " + "and parameter name data is not present in the class file, for: " + param.getDeclaringExecutable() + "::" + param)); return (stmt, arg) -> { if (arg == null || IterableLike.isEmpty(arg)) { bindList.onEmpty().define(stmt, name); } else { stmt.bindList(name, IterableLike.toList(arg)); } }; } }