title: How can I convert a map to an object?
body: <p>I made a Map to store the values of all tags on a SOAPMessage body, so that the keys of the Map are the node names and the values are the text contents. I have an object where I already have the fields named after the node names, what I need to do is to set their values accordingly to their map counterparts. </p>
  
  <p>Say that I have a node named "Summary" on the SOAPMessage, there will be a Map key named "Summary" and also an object field named "Summary". I need the object field "Summary" to be set as the value of the Map.get("Summary").</p>
  
  <p>I know I could just fill my code with setters for each of the fields, but is there an way to set the entire object from the Map?</p>
  
  <p>This is the method where I created the Map.</p>
  
  <pre><code>private static Map&lt;String, String&gt; mapIncidentInfo(SOAPMessage soapResponse) throws SOAPException {
  
      Map&lt;String, String&gt; fields = new HashMap&lt;String, String&gt;();
      NodeList nodes = soapResponse.getSOAPBody().getFirstChild().getChildNodes();
  
      for (int i = 0; i &lt; nodes.getLength(); i++) {
          Node node = nodes.item(i);
          fields.put(node.getNodeName(), node.getTextContent());
      }
  
      return fields;
  }
  </code></pre>
  
  <p>This could be used as an object class example:</p>
  
  <pre><code>public class IncidentPO {
  
      private String Submitter;
      private String Submit_Date;
      private String Last_Modified_By;
      private String Last_Modified_Date;
      private String Status;
      private String Short_Description;
  
      public IncidentPO(String Submitter, String Submit_Date, String Last_Modified_By, String Last_Modified_Date, String Status, String Short_Description) {
      this.Submitter                      = Submitter;
      this.Submit_Date                    = Submit_Date;
      this.Last_Modified_By               = Last_Modified_By;
      this.Last_Modified_Date             = Last_Modified_Date;
      this.Status                         = Status;
      this.Short_Description              = Short_Description;
  
      //getters and setters here
  </code></pre>