David Boaz wrote:
Hi,
In my application we use few value objects. For example, Dates, Quantities
and Durations. These objects are immutable and have some behavior. For
example, comparing two quantities may involve quantity-conversion
computations (“2 foot” < “3 meter”).
In drools documentation I found an interesting example (section
6.5.2.1.1.3.2. Literal Restrictions, example 6.20):
Cheese( bestBefore < “27-Oct-2007”)
How Does the parser knows to create a Date object from that String? Does
Date has a ‘specialized’ behavior in drools? Is it possible to ‘plugin’
similar behavior for my value classes? How?
I’d like to achieve the following functionality:
Person(height < “2-meter”)
We have built in type co-ercion, unfortunately this is not pluggable and
fixed around numbers, strings and dates. We are looking to have built in
unit support at some time, but no specific dates for this, we are
waiting for the feature to make it's way into MVEL, probably around Q3 I
guess, you'll have to ask the MVEL author.
Mark
Thanks, David