Hybris 是";重新声明=";“真的”&引用;允许我更改子类型的属性类型吗?
如果我有:Hybris 是";重新声明=";“真的”&引用;允许我更改子类型的属性类型吗?,hybris,Hybris,如果我有: <itemtype code="A"> <attributes> <attribute qualifier="attributeA" type="java.lang.String"> <modifiers .../> </attribute> </attributes> </itemtype> 及 如果我使用“redeclare=
<itemtype code="A">
<attributes>
<attribute qualifier="attributeA" type="java.lang.String">
<modifiers .../>
</attribute>
</attributes>
</itemtype>
及
如果我使用“redeclare=true”,会发生什么?这样可以更改属性的类型吗?例如,我是否可以编写type=“java.lang.Integer
,而不是type=“ATTENTION.HERE”
?如果是,这个“attributeA”是否仅为B的类型Integer
基本上,您只能使其成为父类定义的更具体的子类型。是的,我已经读过了,但我不确定这是否是答案。谢谢:您可以将属性重新声明为:-更改其行为。例如,您可以添加“唯一”标记,或不允许写入。-使属性的类型对于子类型更具体。
<itemtype code="B" extends="A">
<attributes>
<attribute qualifier="attributeA" redeclare="true" type="ATTENTION.HERE">
<modifiers .../>
</attribute>
</attributes>
</itemtype>