Let's start with a code example, ideally, I would like it was possible to do this.
Since MyOtherClass is a generic
class MyOtherClass<Z>{}
I would like to get the Z of MyOtherClass
class C<T extends MyOtherClass<Z>> {
Z myTypeOfReturnMethod() { return doStuff(); }
}
Unfortunately, as far as I know, I cannot specify , and the only valid grammar would be
class C<T extends MyOtherClass> {
???MyOtherClass.Z??? myTypeOfReturnMethod() { return doStuff(); }
}
What is the nicest way to do this? C could have two generics, but it is kind of repetitive and error prone.
Aucun commentaire:
Enregistrer un commentaire