本文介绍了在Drools中,什么是Mvel方言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Drools的新手.我正在创建规则,但出现编译时错误
I am new to Drools. I am creating a rule but I get a compile time error
我尝试检查Jboss示例,其中使用了方言奇迹" .它编译了.我不了解方言.那么什么是dialect=mvel
?
I've tried to check with Jboss examples, where they use dialect "mvel". It compiled. I didn't understand about dialect. So what is dialect=mvel
?
推荐答案
mvel
或 MVFLEX表达式语言具有丰富的语法,其中许多语法允许使用更简洁明了的代码(且比java
少的命令性),例如
mvel
, or the MVFLEX Expression Language has a rich syntax, many of which allow for more concise and expressive code (and less imperative) than java
, e.g.
- 用于
get()
ters/set()
ters(例如封装私有字段)的简写,可以使用另一种property
样式语法(类似于.Net中的VB或C#属性)
- Shorthand for
get()
ters /set()
ters (e.g. encapsulating private fields) to be accessed in an alternativeproperty
style syntax (similar to VB or C# properties in .Net)
即.代替
myObject.setSomeField("SomeValue");
int x = myObject.getSomeIntField();
您可以使用语法(也请注意细微的大小写开关):
You can use the syntax (note the subtle capitalization switch as well):
myObject.someField = "SomeValue"
x = myObject.someIntField // Type inferrence
-
return
语句是可选的(在许多功能语言(如Scala中都可以找到)的约定)和分号一样,除非每行有多个语句: - The
return
statement is optional (a convention found in many functional languages like Scala), as is the semi-colon, unless you have multiple statements per line:
x // i.e. return x;
- 按顺序创建速记数组和建立索引
foos = {2, 4, 6, 8, 10}
foos[3] // foos.get(3)
- 类似地用于地图(词典)
bars = ["a" : "Apple", "b" : "Basket"] // Hashmap, with put
bars["a"]
bars.a // Similar to dynamically typed object e.g. in javascript, if key is a string.
- 空安全导航运算符(例如Rosyln中的空条件运算符)
foo.?bar.baz // if (foo.bar != null) { return foo.bar.baz; } else { return null; }
这篇关于在Drools中,什么是Mvel方言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!