title: Passing class in Hashmap and how to get the value using key
body: <p>I am trying pass class as value in hashmap. I need to get the class(value) using particular key and instantiate an object for the retrieved class. but in order to create object, i need to pass parameters.</p>
  
  <p>My flow goes here, when i call the getExpo method from another class passing the key value. using the key value, i need to get the correct class and using that class need to instantiate the object and need to return the object. Inorder to create object, i need to pass the arguments since the class doesnot have default constructors.</p>
  
  <p>The purpose of this procedure is in future, i need to add another key ,pair value, i shouldnot do any change........the implementation is same for all class ie creating the object</p>
  
  <p>My class goes here</p>
  
  <pre><code>public class ExampleFactory {
  
      static {
          HashMap&lt;String,Class&lt;?&gt;&gt; hmap = new HashMap&lt;String,Class&lt;?&gt;&gt;();
  
          hmap.put("jxpath", JXPathExpression.class);
          hmap.put("spel", SpelExpression.class);
      }
  
      public Predicate getExpo(String key,String expression) {
  
          // Need to get the class using key value and instantiate the object for the class
          // but i need to pass parameters in order to create the object.something like this
  
          //JXPathExpression object = new JXPathExpression(expression);
          return null;
      }
  }
  </code></pre>