2) A different approach, where the context is simple (allowing recycling w/o much effort of other backing impls) and Jexl is smart
Regarding #2, I can see 2 approaches.
One is to do it during evaluate(), like you proposed, which will change the state of some of the objects in the context, and not all if something is wrong :
nuclearReactor.start(); nuclearReactor.setTemparature(temp); nuclearReactor.stop();
Granted, I know that you can't always ensure you get through, but still, adding another way causes concern. On the flipside, it's simple....
The other would be to have a checker that takes an expression and figures out if it will go given a context. That leads to a two step execution process, where you'd first run the check and then evaluate()....
Comments?
an alternative approach..
lets leverage the map! the map knows if a variable exists. So how about JexlExpression.setExplicitVariableDeclaration( true ); and then Jexl just does (in ASTIdentifier, and I think that might be the only place..)
if( isExplicitVariableDeclaration ) { final Map vars = jc.getVars();
if( vars.doesKeyExist( val ) ) { return vars.get( val ); } else { throw new UnknownVariableException( val ); } } else { return jc.getVars().get( val ); }
-pete
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]