I'd like to implement the following classes with the following hierarchy:
public class DwellingPropertySetter
extends AbstractPropertySetter<Dwelling>
public class HousePropertySetter
extends DwellingPropertySetter<House>
public class SkyscrapperPropertySetter
extends HousePropertySetter<Skyscrapper>
Unfortunately this code won't compile. A way to do it would be this:
public class DwellingPropertySetter<T extends Dwelling>
extends AbstractPropertySetter<T>
public class HousePropertySetter<T extends House>
extends DwellingPropertySetter<T>
public class SkyscrapperPropertySetter<T extends Skyscrapper>
extends HousePropertySetter<T>
But for me those extends
keywords are unnecessary.
Whenever I want to use a SkyscrapperPropertySetter
I'd have to specify a type parameter. This is useless and would then look like SkyscrapperPropertySetter<Skyscraper>
.
Do you know a way out for me? The only other way I know to realise my first hierarchy would be using interfaces and delegate methods.