将接口添加到 Jrules BOM 包
我一直在搜索设置,我正在手动重新创建 Jrules BOM 项目中的 Java 项目,但是我看不到实现自定义界面的方法。 :(
I've been searching through settings I'm manually recreating the Java project I have within my Jrules BOM project however I see no way of implementing a custom interface. :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不。
您的 BOM 基于您的 XOM(JAVA 类),所以基本上:
您可以根据 BOM 编写规则,并且 BOM 会映射到运行时的 XOM。
您永远不会实例化接口,因此您无法将其添加到 BOM 中并使用它来编写规则,因为您永远无法像这样执行它。
您只能导入实现您的接口的类并在 BOM 中用语言表达它。
这意味着在运行时,引擎将知道要使用什么类(实例)。
顺便说一句:请记住,您的 BOM 应尽可能小。
BOM可以引用(就像JAVA项目一样)
您应该仅在 BOM 中导入用户创作规则所需的类。
不要填充 BOM,并且默认情况下不要用语言表达它。否则,在使用自动完成功能时,您最终会得到一个无法使用的界面。除非您使用类别,但即使认为,一个很好的做法是您有一个小的 BOM,其中仅包含“规则创建有用的类”。
通过引用,我的意思是您可以有一个规则项目 BOM1、一个仅包含 BOM 的规则项目 BOM2 和 BOM3。以及一个仅包含规则和引用的“正确”规则项目:
例如 BOM1、BOM2 和 BOM3。
保持简单:)
No.
Your BOM is based on your XOM (JAVA classes) so basically:
You write your rules based on the BOM and the BOM is mapped to the XOM for runtime.
You will never instantiate an interface so there is no way for you to add it in the BOM and to use it to author a rule because you will never be able to execute it like this.
You can only import a classe implementing your interface and verbalize it within your BOM.
Meaning that at runtime, the engine will know what class (instance) to use.
BTW: Keep in mind that your BOM SHOULD BE as small as possible.
BOM can be referenced (just like JAVA project)
You should import in your BOM ONLY and ONLY the classes that users will need to author the rule.
Do not poluate the BOM and do not verbalize it by default. Otherwise you will end up with a proper unusable interface when using auto-completion. Except if you are using Categories but even thought, a very good practice is you to have a small BOM where only "rule creation useful class" are included.
By referencing, I mean you could have a rule project BOM1, a rule roject BOM2 and BOM3 containing only the BOMs. And a "proper" rule project containing just rules and referencing:
BOM1, BOM2 and BOM3 for instance.
Keep it simple :)