Rule engine ilog规则中的ArrayList
我在ilog规则中工作。我想验证对象数组列表中的字段 像Rule engine ilog规则中的ArrayList,rule-engine,ilog,jrules,Rule Engine,Ilog,Jrules,我在ilog规则中工作。我想验证对象数组列表中的字段 像 class Company { List<Employee> employee; } class Employee { String Name; int age; } 现在,我如何迭代作为arraylist的employee并检查年龄验证 使用“in”BAL构造将集合中的单个雇员绑定到定义语句中的变量,然后为该雇员编写验证规则 请参阅IBM ODM版本的知识中心/信息中心,例如: 您可以尝试以下方
class Company {
List<Employee> employee;
}
class Employee {
String Name;
int age;
}
现在,我如何迭代作为arraylist的employee并检查年龄验证 使用“in”BAL构造将集合中的单个雇员绑定到定义语句中的变量,然后为该雇员编写验证规则 请参阅IBM ODM版本的知识中心/信息中心,例如: 您可以尝试以下方法:
definitions
set 'employee' to an employee in the employees of 'the company' ;
if
the age of employee is less than 0
then
print "Age of employee " + the name of employee + "' is negative: " + the age of employee ;
else
print "Age of employee " + the name of employee + "' is OK: " + the age of employee ;
我相信您会尝试年龄>0的条件。只是想进一步了解一下,您要验证的是哪里?所以它将自动迭代所有employee对象?是的,它将按照您的预期运行。
definitions
set 'employee' to an employee in the employees of 'the company' ;
if
the age of employee is less than 0
then
print "Age of employee " + the name of employee + "' is negative: " + the age of employee ;
else
print "Age of employee " + the name of employee + "' is OK: " + the age of employee ;