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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -