[rules-dev] Implicit package imports

Michael Anstis michael.anstis at gmail.com
Sat May 7 17:42:03 EDT 2011


Hi,

I'm fixing a bug in all of Guvnors' guided editors:
https://issues.jboss.org/browse/GUVNOR-1362

The existing problem is if a model Date field is set in one of the guided
editors RHS we need to convert the String into a Date for use in the set
Method (currently we attempt to pass the String which fails).

I have a working solution however it requires the user to explicitly add a
package import for "java.text.SimpleDateFormat" that handles the parsing.
This can be accomplished through the UI.

I have two options to remove the need for the user to do anything:-

(1) Pre-process all rules to be included in the package, check if one uses
Date in the RHS and if so add an import into the header. I'd need to
pre-process all rules as the package DRL String is built linearly and by the
time the package compiler gets to a rule that uses a Date in the RHS the
header, including imports, has already been built.

(2) Add (another) implicit import into *all* packages. I assume we already
do something like this for the boxed primitives and some others (List?
Collection? Map? etc).

Before I venture into option (1) can any (core) developer advise (1) where
can I add an additional implicit import (I assume the compiler somewhere),
(2) is this simpler solution acceptable to the (core) developers?

Thanks,

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110507/7097a30a/attachment.html 


More information about the rules-dev mailing list