title: Java find setters and getters by reflection
body: <p>i have a class like this</p>
  
  <pre><code>public class Student
  {
  
      private String reference;
      private String aPlaceAt;
      //methods generate by Netbeans Eclipse generates the same methods
      public String getaPlaceAt(){return aPlaceAt;}
      public void setaPlaceAt(String aPlaceAt){this.aPlaceAt = aPlaceAt;}    
      public String getReference(){return reference;}
      public void setReference(String reference){this.reference = reference;}       
  }
  </code></pre>
  
  <p>later i need to find the setters and getters by each property by <code>reflection</code> i am using the following code</p>
  
  <pre><code>public Method findSetterFor(final Class clazz,final String propertyName) throws Exception
  {
      return new PropertyDescriptor(propertyName,clazz).getWriteMethod();
  }
  
  for(final Field field:clazz.testClazz.getDeclaredFields())
  System.out.println(field.getName()+" "+clazz.findSetterFor(clazz.testClazz,field.getName()));        
  </code></pre>
  
  <p>they return the correct setter for reference but for the property <em>aPlaceAt</em></p>
  
  <p>throws </p>
  
  <pre><code>Exception in thread "main" java.beans.IntrospectionException: Method not found: isAPlaceAt
  </code></pre>
  
  <p>why isAPlaceAt? not should be </p>
  
  <pre><code>public void setaPlaceAt(String aPlaceAt){this.aPlaceAt = aPlaceAt;}?
  </code></pre>
  
  <p>or why i am doing wrong? how can accomplish it thanks?</p>
  
  <p>i think the setters and getters are generate correctly according to other post at SO and this link</p>
  
  <p><a href="http://dertompson.com/2013/04/29/java-bean-getterssetters/" rel="nofollow noreferrer">Link</a></p>
  
  <p>the methods are generate by <code>Netbeans and Eclipse and intellij</code></p>
  
  <p><strong>UPDATE</strong>
  here is another hot forum about it this same problem please check it out</p>
  
  <p><a href="https://stackoverflow.com/questions/2948083/naming-convention-for-getters-setters-in-java">Another SO post</a></p>