[英]Can generic types be used as the “type” of a composite component's attribute tag?
It looks to me like composite components' attributes don't allow generic types. 在我看来,复合组件的属性不允许通用类型。 Here's a simple test case:
这是一个简单的测试用例:
<cc:attribute name="stringList" type="java.util.List<java.lang.String>" />
The error I get is, 我得到的错误是,
java.lang.ClassNotFoundException: java.util.List<java.lang.String>
(If I replace the < and > with < and >, I get a error because that's not valid XHTML.) (如果用<和>替换&lt;和&gt;,则会收到错误消息,因为那不是有效的XHTML。)
I know that the generic part of the type will be erased at runtime, but I was hoping to use generics here just for clarity of reading the code. 我知道类型的泛型部分将在运行时删除,但是我希望在这里使用泛型只是为了阅读代码。 Is that possible?
那可能吗?
没有人不可能
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.