java中的通用超类

2024-03-06

是否有可能在java中创建类似的东西

public abstract class GenericView<LAYOUTTYPE extends AbstractLayout> extends LAYOUTTYPE

so that

public class MyView extends GenericView<HorizontalLayout>

extends GenericView and HorizontalLayout and

public class MyView2 extends GenericView<VerticalLayout>

extends GenericView and VerticalLayout?


简短的回答是——不。你的类型extends必须是实际类型,而不是泛型类型参数。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

java中的通用超类 的相关文章

随机推荐