public void fillStatementWithBean()

in src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java [369:389]


    public void fillStatementWithBean(final PreparedStatement stmt, final Object bean,
            final PropertyDescriptor[] properties) throws SQLException {
        final Object[] params = new Object[properties.length];
        for (int i = 0; i < properties.length; i++) {
            final PropertyDescriptor property = properties[i];
            Object value = null;
            final Method method = property.getReadMethod();
            if (method == null) {
                throw new IllegalArgumentException("No read method for bean property " + bean.getClass() + " " + property.getName());
            }
            try {
                value = method.invoke(bean);
            } catch (final IllegalArgumentException e) {
                throw new IllegalArgumentException("Couldn't invoke method with 0 arguments: " + method, e);
            } catch (final InvocationTargetException | IllegalAccessException e) {
                throw new IllegalArgumentException("Couldn't invoke method: " + method, e);
            }
            params[i] = value;
        }
        fillStatement(stmt, params);
    }