I am new to Drools. I am creating a rule but I get a compile time error
\"field is not visible\'.
I\'ve tried to check with Jbo
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 (e.g. encapsulating private fields) to be accessed in an alternative property
style syntax (similar to VB or C# properties in .Net)ie. instead of
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
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.
foo.?bar.baz // if (foo.bar != null) { return foo.bar.baz; } else { return null; }