01: package org.drools.rule.builder.dialect.mvel;
02:
03: import org.drools.compiler.Dialect;
04: import org.drools.compiler.DialectConfiguration;
05: import org.drools.compiler.PackageBuilder;
06: import org.drools.compiler.PackageBuilderConfiguration;
07:
08: /**
09: * The MVEL dialect.
10: *
11: * drools.dialect.mvel.strict = <true|false>
12: *
13: * Default strict is true, which means all expressions and the consequence are type safe.
14: * However dynamic mode is still used while executed nested accessors in the field constraints.
15: *
16: */
17: public class MVELDialectConfiguration implements DialectConfiguration {
18:
19: private MVELDialect dialect;
20: private PackageBuilderConfiguration conf;
21:
22: private boolean strict;
23:
24: public Dialect getDialect() {
25: if (this .dialect == null) {
26: this .dialect = new MVELDialect();
27: }
28: return this .dialect;
29: }
30:
31: public void init(PackageBuilderConfiguration conf) {
32: this .conf = conf;
33: setStrict(getStrict());
34: }
35:
36: public PackageBuilderConfiguration getPackageBuilderConfiguration() {
37: return this .conf;
38: }
39:
40: public void setStrict(boolean strict) {
41: this .strict = strict;
42: }
43:
44: public boolean isStrict() {
45: return this .strict;
46: }
47:
48: private boolean getStrict() {
49: final String prop = this .conf.getChainedProperties()
50: .getProperty("drools.dialect.mvel.strict", "true");
51: return Boolean.valueOf(prop).booleanValue();
52:
53: }
54:
55: }
|