这是我的代码:
public void onValidate(final Object o, final InterceptorContext ctx) throws InterceptorException
{
if (o instanceof ProductModel)
{
final ProductModel product = (ProductModel) o;
if (!ctx.isNew(product))
{
if (StringUtils.isEmpty(product.getCode()))
{
throw new InterceptorException("The Code must not be empty!");
}
if (StringUtils.isEmpty(product.getManufacturerName().toString()))
{
throw new InterceptorException("The ManufacturerName must not be empty!");
}
if (ctx.isModified(product, ProductModel.MANUFACTURERPRODUCTID)
|| ctx.isModified(product, ProductModel.MANUFACTURERNAME))
{
final boolean b = ProductLookupService.getProductforManufacturerName(product.getManufacturerName().toString());
...
}
Run Code Online (Sandbox Code Playgroud)
我需要枚举 ManufacturerName 的名称来将它与另一个字符串进行比较,但是我的生成的 getManufacturerName 只返回代码。我有哪些选择?这是 -item.xml 和我生成的 get 方法:
<enumtype code="ManufacturerName" generate="true" autocreate="true" dynamic="true"/>
<itemtype code="Product" …Run Code Online (Sandbox Code Playgroud) hybris ×1