Using Generic Type Parameter classes
<p>I have the following class in my code</p>

<pre><code>public class GenericService&lt;E&gt; extends  SpringAndroidSpiceRequest&lt;E&gt; {
    public GenericService(Class&lt;E&gt; clazz) {
        super(clazz);

    }
    @Override
    public E loadDataFromNetwork() throws Exception {
        return null;
    }
}
</code></pre>

<p>Now the constructor for this class takes a Argument of type class. i want to remove this parameter, and directly say something like super(E.class) ? But this is given my an error. So if i GenericService loginService=new GenericService 
that constructor should call super with the params Login.class. This works like this but not the generic way by saying E.class. How can i do this ? </p>

<h1>EDIT</h1>

<p>I want to merge the following classes into a single clas</p>

<p>public class LoginService extends SpringAndroidSpiceRequest {</p>

<pre><code>private Login.Request loginRequest;
private final String loginRequestURL = "/login";

public LoginService() {
    super(Login.Response.class);
}

public final Login.Response loadDataFromNetwork() throws Exception {

    Uri.Builder uriBuilder = Uri.parse(
            ProfileInfo.getActiveProfile().getbaseURL() + loginRequestURL)
            .buildUpon();
    String url = uriBuilder.build().toString();

    return getRestTemplate().postForObject(url, loginRequest,
            Login.Response.class);
}

@Override
public final String createCacheKey() {
    return loginRequest.getUsername() + "" + loginRequest.getPassword();
}
</code></pre>

<p>}</p>

<p>and</p>

<pre><code>public class ForgetPasswordService extends
            SpringAndroidSpiceRequest&lt;ForgetPassword.Response&gt; {

        private final String forgotPasswordURL = "/forgotpassword";

        public ForgetPasswordService() {
            super(ForgetPassword.Response.class);
        }

        public final ForgetPassword.Response loadDataFromNetwork() throws Exception {

            Uri.Builder uriBuilder = Uri
                    .parse(ProfileInfo.getActiveProfile().getbaseURL()
                            + forgotPasswordURL).buildUpon();
            String url = uriBuilder.build().toString();
            return getRestTemplate().postForObject(url, forgotPasswordRequest,
                    ForgetPassword.Response.class);
        }

        public final String createCacheKey() {
            return forgotPasswordRequest.getPhoneOrEmailAddress();
        }

    }
</code></pre>

<p>Both classes are identicle. The only difference between is the type of response they are given out. Now i have about 23 of these classes. Really abad idea adding all of these classes if they are not needed.</p>

<p>Kind Regards</p>
