On Tue, 2004-01-13 at 17:22, Bill Horsman wrote: > (Yet) another solution: > > Get the JexlContext to track which variables it was asked for. Note > which ones were known and which were not known. Then you can ask > JexlContext for the list at the end.
I got so enthused by this idea that I decided to just do it. There is a new method on Expression: CheckResults check(JexlContext context) throws Exception; And CheckResults contains: Object getAnswer(); String[] getKnownVariables(); String[] getUnknownVariables(); String[] getUsedVariables(); (It's documented better in the patch). Good things: It doesn't break the current API It gives more information than before: a list of all the unknown variables (not just the first one encountered), and a list of all the used variables (this is a nice to have for my current app) Bad things: It needs to clone the JexlContext to make it thread-safe. This is done transparently, but it might effect performance. But then again, I don't think it's significant. (Actually, as I write this I realise that it doesn't need to clone it - just wrap it. But the shallow clone of Map is not too lengthy anyway). It's not a simple configuration change to make it lenient or strict. You need to call a different method (check instead of evaluate). I suppose you could make evaluate do something similar (and just throw an exception that contained the CheckResults or something). The patch is an tar archive because I still haven't found a way of bundling the new files in the patch file. The archive contains two new Java files and the patch file. - Bill
jexl-bh-3.tar.gz
Description: application/compressed-tar
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]