简体   繁体   English

DROOLS中“ package”关键字的用途是什么?

[英]What are the uses of 'package' keyword in DROOLS?

In my scenario, we have multiple rule files and we ensure with proper naming convention that every rule name is different, even if they are in different folders, files. 在我的方案中,我们有多个规则文件,并且使用正确的命名约定确保每个规则名称都不同,即使它们位于不同的文件夹,文件中也是如此。

We use a common package name in all the drl files. 我们在所有drl文件中使用通用的软件包名称。

Now even if I remove the package name it is working fine(test cases I have checked). 现在,即使我删除了程序包名称,它也可以正常工作(我检查过的测试用例)。

So now I am confused on why and What all are the uses of 'package' keyword. 因此,现在我对“ package”关键字的全部用途和目的感到困惑。

I already understand that it is much like package in java and used so that we can have same name rules, declared type and imports in different packages. 我已经了解到,它非常类似于java中的包并使用过,因此我们可以在不同的包中使用相同的名称规则,声明的类型和导入。 So, do we also need this if we already ensure that everything we write will have a unique name? 那么,如果我们已经确保编写的所有内容都具有唯一名称,我们是否也需要此名称?

DRL packages create different namespaces for rules. DRL包为规则创建了不同的命名空间。

DRL packages also permit an access of Java classes without an import statement if the DRL package is the same as the Java package. 如果DRL包与Java包相同,则DRL包也允许在不使用import语句的情况下访问Java类。

You don't need to use packages in DRL, but I recommend to use it, even if it is all in a single package. 您不需要在DRL中使用软件包,但是即使所有软件包都在一个软件包中,我也建议您使用它。 Who knows what tomorrow will bring? 谁知道明天会带来什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM