You could also use the field in a predicate constraint rather than an eval.
cheers Steve On 1/4/07, Michael Neale <[EMAIL PROTECTED]> wrote:
No thats a good question. Unfortunately t the moment that is what you have to do (using eval). There may be a few more options in a future version, but can't say at this stage. I am hoping one day to have "pluggable operators" so you can define them to do what you want and register them with the engine, but it is quite a bit of refactoring to do that (there is a JIRA for it, its number escapes me). Moreover, why that XMLGregorianCalendar is not comparable is beyond me. The idiocy in the java date APIs knows no bound ;) Fortunately, hope is at hand (eventually), Jodatime will save us all (but I digress). In the meantime, I would seriously consider an alternative to that JAXB implementation if it can't use a proper calendar class ! Michael. On 1/3/07, Justine Hlista <[EMAIL PROTECTED]> wrote: > > Hello, I am new to JBoss Rules, so this might be an obvious question. I > am generating Java objects from xsd's using jaxb/xjc. These objects are used > as facts in the working memory. Some of the fields in these objects need to > be times; however, jaxb likes to convert xs:time types to > XMLGregorianCalendar in the Java object. When I try to use such a field as a > restriction, e.g. timeA <= timeB, an exception is thrown because the > XMLGregorianCalendarImpl cannot be cast to a Comparable. > > Am I doing something particularly stupid, or is there a way around this? > > > My workaround is to write a function in my rules file that compares to > XMLGregorianCalendar objects and eval it. But it would be nice to be able to > use XMLGregorianCalendars as restrictors in a rule. > > Thanks, > Justine > >
-- Steven Williams Supervising Consultant Object Consulting Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501 [EMAIL PROTECTED] www.objectconsulting.com.au consulting | development | training | support our experience makes the difference