我有一个类似下面的项目类型.
<itemtype code="ApparelProduct" extends="Product" autocreate="true"
generate="true" jaloclass="com.jay.core.jalo.ApparelProduct">
<description>Base apparel product extension that contains additional attributes.</description>
<attributes>
<attribute qualifier="genders" type="GenderList">
<description>List of genders that the ApparelProduct is designed for</description>
<modifiers />
<persistence type="property" />
</attribute>
</attributes>
</itemtype>
Run Code Online (Sandbox Code Playgroud)
我想添加一个名为spacialDiscount上述项类型的新属性.
您可以在您自己的扩展myextensionname-items.xml文件中声明它,但您必须设置,autocreate="false"因为它已经由声明项类型的第一个扩展创建,否则平台将在构建期间抛出错误.你还需要省略jaloClass属性(或者定义一个新属性,即从已经定义的属性中定义一个新属性,但是将其保留下来就好了,因为你可能不再使用jalo层了,因为它最终被逐步淘汰) .
请注意,您甚至可以使用redeclare属性标记内的属性(例如<attribute qualifier="code" redeclare="true"...>标记)重新声明现有属性.
例:
<itemtype code="ApparelProduct" extends="Product" autocreate="false"
generate="true">
<attributes>
<attribute qualifier="specialDiscount" type="myType">
<description>my new attribute</description>
<persistence type="property" />
</attribute>
</attributes>
</itemtype>
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助.
| 归档时间: |
|
| 查看次数: |
3577 次 |
| 最近记录: |