Search code examples
sap-commerce-cloud

Is "redeclare="true"" allowing me to change the attribute type for a subtype?


If I have :

<itemtype code="A">
    <attributes>
       <attribute qualifier="attributeA" type="java.lang.String">
         <modifiers .../>
       </attribute>
    </attributes>
</itemtype>

And

<itemtype code="B" extends="A">
    <attributes>
       <attribute qualifier="attributeA" redeclare="true" type="ATTENTION.HERE">
         <modifiers .../>
       </attribute>
    </attributes>
</itemtype>

What happens if I use "redeclare=true"? Will this let me change the attribute's type? For example, instead of type="ATTENTION.HERE", can I write type="java.lang.Integer? And if so, will this "attributeA" be of type Integer only for B?


Solution

  • See the Redeclaring Attributes section in https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/2005/en-US/8bffa9cc86691014bb70ac2d012708bc.html

    Basically you can only make it a more specific subtype of what the parent class defined.