title: Create a Map of all the parameter names and values of a method
body: <p>I am working on REST API service and each time when exception is occured I need to show in logs params , method and class name where this exception happened. So i have singleton class with method</p>
  
  <pre><code>public void log(final String className,String methodName,final Map&lt;String,String&gt; params,final String cause) {
      final StringBuilder result=new StringBuilder();
      for (Map.Entry&lt;String, String&gt; entry : params.entrySet()) {
          result.append(entry.getKey()+" "+entry.getValue()+" ");
      }
      log.info("\n\t\t\tClass: "+className+"\n\t\t\t Method: "+methodName+"\n\t\t\t Params: "+result.toString()+" \n\t\t\t "+"Reason: "+cause);
  }
  </code></pre>
  
  <p>Example of use</p>
  
  <pre><code>public String checkSession(String sid) {
      final Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
      params.put("sid", sid);
      if (sid.isEmpty()) {
          logger.log(this.getClass().getSimpleName(), "checkSession", params, " not valid session");
          return Enums.Error.WRONG_SESSION.toString();
      }
  }
  </code></pre>
  
  <p>However in each method I need to initialize this map with all params. How can I write method that will return Map for all methods?</p>
  
  <p>For example I have two methods</p>
  
  <pre><code>public String createPass(String name,String surname) {
      final Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
          params.put("name", name); 
          params.put("surname", surname); 
      }
  
  public String checkSession(String sid) {
      final Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
      params.put("sid", sid);
  }
  </code></pre>
  
  <p>And method that I need is something like</p>
  
  <pre><code>public HashMap&lt;String,String&gt; method(String args...){
      final Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;
      for(...)
      map.put("parameter","parameterName");
  }
  </code></pre>