I have a class like this:
public class MyClass<T>{
private MyTape data;
private List<T> someOtherdata;
}
I'm trying to write a generic service in Android usign Spring for Android RestTemplate, but this give a type mismatch:
ResponseEntity<MyClass<? extends Parcelable>> test = new ResponseEntity<MyClass<MyOtherType>>(..);
Where MyOtherType implements Parcelable. In there a way around this? My other solution is to use "less generic code" and subclass MyClass
Use
ResponseEntity<? extends MyClass<? extends Parcelable>>
instead of
ResponseEntity<MyClass<? extends Parcelable>>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.