I have a class that will contain the response to be send to UI. The blueprint is as : 

```
class Response<T extends CustomObject> {  
     private String var1;  
     private String var2;  
     private List<T> custom; (eg. customOne, customTwo)
}  

```

I can have different objects like custom objects that are extending CustomObject and based upon that Response class will have different customObject list.  

After applying service logic, I get a raw response and based upon the custom object I try to parse differently.  

CusomOne and CustomTwo will have different structure as : 

```
class CustomOne extends CustomObject {  
    private String v1;  
}  
class CustomTwo extends CustomObject {  
    private String v2;
}  

```

I have an abstract parsing function that will be called based upon the object that is picked. The function is defined as : 

```
public abstract ResponsePayLoad<? extends CustomObject> parseResponse(String response);  

```

ReponsePayLoad is another class that has other fields including CustomObject. The Blueprint for class ResponsePayLoad is as : 

```
class ResponsePayLoad<T extends CustomObject> {  
    private String varX;  
    private List<T> value;  
}  

```

Parsing function for both customObjects will be like :

```
public ResponsePayLoad<customOne> parseResponse(String response){  
    CustomOne one = ; // parsingLogic  
    return one;  
}  
public ResponsePayLoad<customTwo> parseResponse(String response){  
   CustomTwo two = ; // parsingLogic  
    return two;  
}  

```

In my service logic when I write the code as : 

```
ResponsePayLoad<CustomObject> responseObj = parseResponse(response);  

```

I need to typecast it to ResponsePayLoad that I don't want to.  

Could anyone tell me how can I skip using "?" in abstract function and still maintain the same logic? Moreover I don't want to typecast the same as I defined above. Any help would be appreciated.