Creating singleton factory
<pre><code>  String fullName = PATH + "." + name;
  Class cl= Class.forName(fullName);
  if(name.equalsIgnoreCase("MobileSearch")){
   if(msearchType==null){
    msearchType=(SearchInterface)cl.newInstance();
   }
   return msearchType;

  }
  if(name.equalsIgnoreCase("BookSearch")){
   if(bsearchType==null){
    bsearchType=(SearchInterface)cl.newInstance();
   }
   return bsearchType;

  }
</code></pre>

<p>How do I get rid of the <code>if</code> statements here.<br />
I am using reflection.<br />
Please help. Thanks in advance.</p>
