That's because a java.util.Date is not a java.lang.Number. :) You can get the long value behind the Date by calling Date.getTime(), though. Try that.
--- On Thu, 3/24/11, jkrupka <[email protected]> wrote: > From: jkrupka <[email protected]> > Subject: [rules-users] accumulate min over java.util.Date > To: [email protected] > Date: Thursday, March 24, 2011, 12:07 PM > Should I be able to do an accumulate > min over java.util.Date objects? Like > this: > $minDate : Date() from accumulate(MyFact ($startDate : > startDate), > > min($startDate)) > > I would have thought so, but when I try it, I'm getting: > > Caused by: java.lang.ClassCastException: java.util.Date > cannot be cast to > java.lang.Number > at > org.drools.base.accumulators.MinAccumulateFunction.accumulate(MinAccumulateFunction.java:76) > > > > If it should work, then it's possible I'm doing something > else wrong, but > everything looks correct to me. I can always work > around it by getting the > milliseconds from the Date object and doing the min over > that... it's just > not as clean looking. > > -- > View this message in context: > http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-java-util-Date-tp2726081p2726081.html > Sent from the Drools - User mailing list archive at > Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
