我正在尝试在 MVEL 表达式语言的 OVAL XML 配置文件中编写与以下 java Assert 语句等效的语句。但我无法这样做。任何帮助将不胜感激。
public class BusinessObject
{
// mailingAddress must either be the delivery address or the invoice address
@Assert(expr = "_value ==_this.deliveryAddress || _value == this.invoiceAddress", lang = "groovy")
public String mailingAddress;
}
xml..
<class type="BusinessObject" applyFieldConstraintsToSetters="true" overwrite="false">
<field name="mailingAddress">
<assert lang="mvel" expr="_value ==_this.deliveryAddress || _value == this.invoiceAddress" message="mailingAddress must either be the delivery address or the invoice address ">
</assert>
</field>