On Mon, Jun 11, 2012 at 12:36 AM, Claude Brisson <[email protected]> wrote:
> A VelocityContext object is just a wrapper around a Map, the only point > is just that it does not expose all methods of the wrapped Map. > > But we don't have to use VelocityContext directly: the only constraint > is that we implement the org.apache.velocity.context.Context interface. > So the easiest way is maybe to have VelocityBindings inherit Map and > implement org.apache.velocity.context.Context directly. > +1, Will try and update you if problems occurs. Unless will commit the proposed changes > > > Claude > > On Sun, 10 Jun 2012 12:15:26 +0530 > Dishara Wijewardana <[email protected]> wrote: > > > Hi all, > > Wrapping VelocityContext as the ScriptContext in JSR 223 seems not > > possible as the intended behavior of each implementation is > > quite different. Because VelocityContext is more like expected to > > behave as a Map with having additional ability to have an inner > > context and etc. > > > > So this VelocityContext is very much in to the behavior of > > javax.script.Binding which is exactly a Map like behavior. > > I think best way is to use it in that context. But still > > VelocityContext has limited number of methods covers in a Map while > > Bindings interface directly extends java.util.Map. > > > > So what is the best way to accomplish this Bindings concept. But of > > course we should not extend the VelocityContext behavior to go close > > with Bindings. Shall we just wrap the VelocityBindings class with a > > Map object. And in the VelocityScriptEngine, internally we can use(we > > have to) the velocity context for evaluation methods. > > > > What do you think ? > > > > -- Thanks /Dishara
