"redeclare="true"" 允许我更改子类型的属性类型吗?
Is "redeclare="true"" allowing me to change the attribute type for a subtype?
如果我有:
<itemtype code="A">
<attributes>
<attribute qualifier="attributeA" type="java.lang.String">
<modifiers .../>
</attribute>
</attributes>
</itemtype>
和
<itemtype code="B" extends="A">
<attributes>
<attribute qualifier="attributeA" redeclare="true" type="ATTENTION.HERE">
<modifiers .../>
</attribute>
</attributes>
</itemtype>
如果我使用 "redeclare=true" 会怎样?这会让我更改属性的类型吗?例如,我可以写 type="java.lang.Integer
而不是 type="ATTENTION.HERE"
吗?如果是这样,这个 "attributeA" 是否只对 B 是 Integer
类型?
中的重新声明属性部分
基本上你只能使它成为父 class 定义的更具体的子类型。
如果我有:
<itemtype code="A">
<attributes>
<attribute qualifier="attributeA" type="java.lang.String">
<modifiers .../>
</attribute>
</attributes>
</itemtype>
和
<itemtype code="B" extends="A">
<attributes>
<attribute qualifier="attributeA" redeclare="true" type="ATTENTION.HERE">
<modifiers .../>
</attribute>
</attributes>
</itemtype>
如果我使用 "redeclare=true" 会怎样?这会让我更改属性的类型吗?例如,我可以写 type="java.lang.Integer
而不是 type="ATTENTION.HERE"
吗?如果是这样,这个 "attributeA" 是否只对 B 是 Integer
类型?
基本上你只能使它成为父 class 定义的更具体的子类型。