[rules-users] accumulate min over java.util.Date

Greg Barton greg_barton at yahoo.com
Thu Mar 24 13:50:14 EDT 2011


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 <jkrupka at gmail.com> wrote:

> From: jkrupka <jkrupka at gmail.com>
> Subject: [rules-users] accumulate min over java.util.Date
> To: rules-users at lists.jboss.org
> 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
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


      




More information about the rules-users mailing list