java - Finesse Class<E> into Class<E[]> -
public abstract class abstractrestclientservice<e extends idable<string>> implements genericservice<e, string> { private class<e> classtype; private class<e[]> classarray; private string controllerpath; public abstractrestclientservice(final class<e> classtype, final class<e[]> classarray, final string controllerpath) { this.classtype = classtype; this.classarray = classarray; this.controllerpath = controllerpath; this.webservice = new genericwebclientservice<e>(); } // ... other methods }
is there way manipulate classtype classarray don't need pass in classarray parameter?
i hate think best way it, here's how i've handled it.
public abstract class abstractrestclientservice<e extends idable<string>> implements genericservice<e, string> { private class<e> classtype; private class<e[]> classarray; private string controllerpath; @suppresswarnings("unchecked") public abstractrestclientservice(final class<e[]> classarray, final string controllerpath) { this.classtype = (class<e>) classarray.getcomponenttype(); this.classarray = classarray; this.controllerpath = controllerpath; this.webservice = new genericwebclientservice<e>(); } // ... other methods }
Comments
Post a Comment