Tuesday, 27 February
2007
Tue, 27 Feb
'07
3:51 a.m.
Hi everbody,
I'm trying to translate an other rule-language in JBossRules (with
XSL(T)).
One of my major problems is the autoboxing- without unboxing-support in
the engine.
I think it is a general problem, because (1) everyone who is writing a
rule has to know what types the properties in the objects (beans)
to be used are. I think it is enough to know is it a digit, a boolean
or... The trouble begins in an evaluation:
when
Person ($age1 : age, name == 'Mike')
Person ($age2 : age, name == 'Peter')
eval ($age1 > $age2) // !!! it's wrong
eval ($age1.intValue() > $age2.intValue()) // it's ok if the Objects
// are Integer and not
// Double or ...
..
I think a rule-creator without java-knowlege has only little
understanding for this. (... and rules are for specialist from different
domains???)
(2) another conflict is in the different handling in fieldconstraints and
evaluations.
I can use all operators for simple types in field constraints but not in
evaluations:
when
Person (age > 20) // here I use the field as a primintiv type
Person (age < 30)
..
I know that all of them based on java and oop and I need this knowledge
for the RHS, but this confusion is not helpful for beginners or user
from other domains.
I don't know, what the reason for autoboxing (without unboxing
especially in java 5) is.
I'm confused by the documentation.
(Drools Documentation: "... If you use Java 5, then you get the best of
both worlds ..." (context autoboxing).
Another line in the drool documentation: "All bound primitive
declarations are boxed, there is currently no auto-unboxing (if you use
java 5, this is all automatic).")
Will the unboxing be supported in futur versions?
(... or afford a possibility for switch off the autoboxing?)
Thanks,
-jens