java中的最终类意味着它不能被任何其他类扩展。在 -Items.xml 中定义数据模型时,我们如何在 hybris 中做到这一点?
1400 次
1 回答
1
SAP Hybris 平台不支持生成final数据模型类 OOTB(即开即用)。您不能覆盖该机制,但您可以修改位于src目录中的生成类。如果你想要一个final数据模型类(例如 Foo),你可以手动添加这个修饰符。
<itemtypes>
<itemtype code="Foo" jaloclass="org.example.Foo">
<attributes>
<!-- attributes -->
</attributes>
</itemtype>
</itemtypes>
文件结构:
src/org/example/Foo← 你可以把这个类标记为finalgensrc/org/example/GeneratedFoo← 你不能修改这个类
(类Foo扩展GeneratedFoo)
所有具有扩展类型的扩展Foo都将在构建阶段失败。
SAP Hybris 平台仅允许abstract使用abstract等于 的属性设置修饰符true:
<itemtypes>
<itemtype code="Foo" abstract="true">
<attributes>
<!-- attributes -->
</attributes>
</itemtype>
</itemtypes>
于 2017-10-06T13:58:44.837 回答