Thanks to Christoph's patch, the #set() in VTL now supports Maps.
So you can use an object that supports the Map interface such :
#set($ref.Foo = "bar")
and Velocity will try
ref.setFoo( "bar ")
and if that fails
ref.put("Foo", "bar")
Issues and notes, in no real order :
1) I persoanally still am not comfortable about this, but I can't say
why. So who cares... I guess I want to know why this isn't supported
in the bean spec - anyone know?
2) Maybe I'm uncomfortable because it's so specific in that it supports
Map interface, which means Hashtable, HashMap, TreeMap..., rather than
introspecting for put() only, in the same way we look for get()
elsewhere. Of course, getMethod() is something like a gazillion times
slower (really!) than instanceof, and I would guess most people use the
above provided classes, so maybe it's not that important. And you
always have a way out using proper setter methods.
3) It was suggested we chuck Map support in both get() and put() and
stick to the bean spec. :)
Anyway, if anyone sees any problems or issues, speak now or live with it
:)
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity