如何使用 EnumType 声明属性
How to declare attribute with EnumType
在我的项目类型中,我需要使用枚举类型声明属性。但它给出了如下错误
hybris\bin\platform\resources\ant\antmacros.xml:795:
java.lang.ClassCastException: de.hybris.bootstrap.typesystem.YEnumType
cannot be cast to de.hybris.bootstrap.typesystem.YCollectionType
这是我声明的方式
<attribute qualifier="aaa" type="EnumType" autocreate="true" generate="true">
<persistence qualifier="bbbl" type="property" />
<modifiers read="true" write="true" search="true" removable="true"
optional="true" />
<description>aaa</description>
</attribute>
如何跳过那个错误?
你有在枚举类型部分实际创建的枚举类型吗?尝试这样的事情:
<enumtypes>
<enumtype code="MyEnumType" autocreate="true" generate="true" dynamic="false">
<value code="SOMETHING"/>
</enumtype>
</enumtypes>
<attribute qualifier="aaa" type="MyEnumType" autocreate="true" generate="true">
<persistence type="property" />
<modifiers read="true" write="true" search="true" removable="true"
optional="true" />
<description>aaa</description>
</attribute>
这是正确的做法。首先定义枚举类型,然后将其作为普通类型使用。
在我的项目类型中,我需要使用枚举类型声明属性。但它给出了如下错误
hybris\bin\platform\resources\ant\antmacros.xml:795:
java.lang.ClassCastException: de.hybris.bootstrap.typesystem.YEnumType
cannot be cast to de.hybris.bootstrap.typesystem.YCollectionType
这是我声明的方式
<attribute qualifier="aaa" type="EnumType" autocreate="true" generate="true">
<persistence qualifier="bbbl" type="property" />
<modifiers read="true" write="true" search="true" removable="true"
optional="true" />
<description>aaa</description>
</attribute>
如何跳过那个错误?
你有在枚举类型部分实际创建的枚举类型吗?尝试这样的事情:
<enumtypes>
<enumtype code="MyEnumType" autocreate="true" generate="true" dynamic="false">
<value code="SOMETHING"/>
</enumtype>
</enumtypes>
<attribute qualifier="aaa" type="MyEnumType" autocreate="true" generate="true">
<persistence type="property" />
<modifiers read="true" write="true" search="true" removable="true"
optional="true" />
<description>aaa</description>
</attribute>
这是正确的做法。首先定义枚举类型,然后将其作为普通类型使用。