Suppose I have a
"Measurement" class, with a getName() method that returns a String
and with a getValue() method that returns an Object. Sometimes the
Object is a String, sometimes a Integer, sometimes a Double. I know that a "Foo"
Measurement must be an integer, so I could cast (or otherwise coerce) into
a form that can be compared with a constant integer (or other
"Foo" Measurement).
How do I handle this
type of value in the LHS of the rule?
when
$m : Measurement(name == "Foo", value < 10)
then
System.out.println("It's less than ten!");
end
I'd also like to be
able to test for the Objects type (instanceof). I'm using java as my dialect, if
that makes a difference. For other reasons I'd like to avoid having
to either subclass Measurement or add type-specific value
accessors.
-Russ