title: Which design pattern to use for multiple Interfaces with different behaviour
body: <p>I have a one Command Interface like this,</p>
  
  <pre><code>public interface ICommand{
       public abstract Object execute(List&lt;Inputs&gt; inputs);
  }
  </code></pre>
  
  <p>Now I have A command for other type of complex Executions so I came up with the new Command Interface</p>
  
  <pre><code>public interface IComplexCommand {
    public abstract Object execute(ComplexObjects obj);
  }
  </code></pre>
  
  <p>I invoke the commands from the properties file which is done inside a static initializer block of CommandFactory. My Factory method to Invoke looks like this.</p>
  
  <pre><code>ICommand cmd= CommandFactory.getInstance().getCommand("LoopElements");
  // loopElements is the key in properties file to load my com.test.my.LoopElements
  // to call execute of IComplex command it will not work because I have to typecase
  // this I want to avoid.
  </code></pre>
  
  <p>Now I have a issue like when I get the Command I do not want to typecase the Command depending on Interface but I would like to have it understood at runtime, </p>
  
  <p>Can anyone please help me in better designing this. I tried to google but I was not able to get any proper answer because the question is very specific.</p>