[rules-users] Autoboxing

wernejen at TU-Cottbus.De wernejen at TU-Cottbus.De
Tue Feb 27 04:51:14 EST 2007


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



More information about the rules-users mailing list