Designing Services with different types of parameters java
<p>I am working on designing a common <code>Service</code> interface for atleast 5 concrete implementations. Now all these services require different types of inputs. I thought of creating a <code>Param</code> class to hold parameters, so that interface could remain common. but then, for some implementations, some of the fields will be unused. I also thought of using <code>Map</code> to hold my params, but that is also not good(casts and if-elses everywhere). Also, I thought of doing was to create a class with Static methods <code>Service.responseAsPerFirstImplementation(p1, t1, i1)</code> and such. But, this way is not good coding. Please suggest how I should design between Modular design, flexibility vs variability of parameters?</p>

<p>EDIT:
Is below the good way of doing it?</p>

<pre><code>public class Client {

    public static void main(String[] args) {
        System.out.println(Services.response(new UserParam(1, new Date())));
        System.out.println(Services.response(new PatternParam("core")));
    }

}
</code></pre>