title: Get the field name from getter method
body: <p>I need to capture field name of getter method dynamically for dynamic validation and dynamic formatting.
  What is the best and efficient way of doing this.</p>
  
  <pre><code>public class Emp{
      private String firstName;
      private String lastName;
      private String address;
      private int age;
  
      // getter and setters
  }
  
  
  public class MyImplementationClass{
  
      public execute(Emp emp){
          String fName=emp.getFirstName();
          // field name need to be taken here using 'emp.getFirstName()'
          // need field name and value of return value of 'emp.getFirstName()' for dynamic validation and dynamic formatting.
          // here need to call method validateAndFormat() with field name and value.
      }
  }
  
  private String validateAndFormat(String fieldName,String value){
   // read the dynamic validation settings from the xml and  validate/reformat the value
   // this method will validate the field according to xml and return reformatted value.
  }
  private int validateAndFormat(String fieldName,int value){
  //...
  }
  </code></pre>
  
  <p>dynamic validation settings</p>
  
  <pre><code>&lt;message&gt;
      &lt;element field="firstName" length="22" defaultVal=""&gt;&lt;/element&gt;
      &lt;element field="lastName" length="20" defaultVal="ibft"&gt;&lt;/element&gt;
      &lt;element field="address" length="NA" defaultVal=""&gt;&lt;/element&gt;
      &lt;element field="age" length="NA" defaultVal=""&gt;&lt;/element&gt;
  &lt;/message&gt;
  </code></pre>