title: How to implement a hashmap with string as a key and value to it is a function to perform
body: <p>I need a logic to change the below source such that  </p>
  
  <pre><code>if (getString(attributes, NAME_ATTR).equals("Title"))
  {
      object.setTitle(getString(attributes, VALUE_ATTR));
  }
  else if (getString(attributes, NAME_ATTR).equals("Id"))
  {
      object.setID(getString(attributes, VALUE_ATTR));
  }
  else if (getString(attributes, NAME_ATTR).equals("PhoneNumber"))
  {
      object.setPhoneNumber(getString(attributes, VALUE_ATTR));
  }
  else if (*)//lot of cases like this
  {
      object.set*(getString(attributes, VALUE_ATTR));
  }
  ...
  </code></pre>
  
  <p>This needs to be done using a hashMap.   </p>
  
  <p>I want to store "Title", "Id", "PhoneNumber", ..etc. as keys in a hashmap and the values should be doing the functionality "object.setTitle(getString(attributes, VALUE_ATTR))".  </p>
  
  <pre><code>Keys        |   Values
  ----------------------------
  Title       | object.setTitle(getString(attributes, VALUE_ATTR)) (should set the tilte field in the object)
              |
  Id          | object.setId(getString(attributes, VALUE_ATTR)) (should set the id field in the object)
              |
  etc..       | should set the specific field in the object  
  </code></pre>
  
  <p>Is it possible to do this?<br>
  If yes, please give me some pointers on how to implement this? </p>
  
  <p>Thanks.</p>