title: Analog of BeanPropertySqlParameterSource that can handle public fields
body: <p>I have a simple model, instances of which I want to save in MySQL using Spring JDBCTemplate. I use DAO that saves model objects using simple sql (<code>insert into user(id, email...) value (:id, :email...)</code>). Is there any framework that can extract parameters from the model (when the model is just POJO with public fields). So, I need something similar to Spring's <code>BeanPropertySqlParameterSource</code>, but with the ability to work with public fields instead of properties.</p>
  
  <p>Example of the model class:</p>
  
  <pre><code>public class User {
      public int id;
      public String email;
      public String login;
      public String password;
  }
  </code></pre>
  
  <p>I know that extending <code>AbstractSqlParameterSource</code> can solve my problem, but I hope to find existing framework.</p>
  
  <p><strong>UPD</strong></p>
  
  <p>Implementation based on <code>AbstractSqlParameterSource</code>:</p>
  
  <pre><code>public class PublicFieldsSqlParameterSource extends AbstractSqlParameterSource {
  
      Map&lt;String, Object&gt; props = new HashMap&lt;&gt;();
  
      public PublicFieldsSqlParameterSource(Object object) {
          Field[] fields = object.getClass().getFields();
          for (Field field : fields) {
              String name = field.getName();
              try {
                  Object value = field.get(object);
                  props.put(name, value);
              } catch (IllegalAccessException ignored) {
              }
          }
      }
  
      @Override
      public boolean hasValue(String paramName) {
          return props.containsKey(paramName);
      }
  
      @Override
      public Object getValue(String paramName) throws IllegalArgumentException {
          return props.get(paramName);
      }
  }
  </code></pre>