使用同一类的2个对象
我是流口水的新手,必须比较同一类的两个对象的价值。 即,可以说课是这样的,
public class Person() {
public string Name;
}
所以我想比较Person1的名字和Person2的名字,并在它们相等的情况下引发例外。 如果有人可以给出同样的例子,那就太好了。
I am new to Drools and have to compare value of 2 objects of same class.
i.e. let's say the class is
public class Person() {
public string Name;
}
So I want to compare person1's name and person2's name and throw an exception if they are equal.
It would be great if someone can give an example of the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以轻松地使用类似的规则来完成:
我会阻止您简单地在
中抛出一个例外,然后
一部分规则。最好的主意是在某个地方收集结果,然后在流口水之外验证这些结果。That can easily be done with a rule similar to this:
I would discourage you to simply throw an exception in the
then
part of the rule though. It is a better idea to collect your results somewhere and then validate those results outside Drools.