velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claude Brisson" <cla...@savoirweb.com>
Subject Re: Map support in VTL
Date Thu, 10 Oct 2002 11:02:25 GMT
> What I don't think I said properly, but what I meant is I haven't
> seen a language that supports the ability to create a Map-type-object and
> initialise it with values at declaration like you can with, as an example,
> an array in Java (.e.g String[] string = new String[]{"blah", "blah",
> "blah"};)  The syntax for doing something similar for a Map seems to be
> harder to read, and I wonder if that's why it's never been done.

hum... not any perl monger over here ? ;-)

CloD

----- Original Message ----- 
From: "Paul Smith" <Paul.Smith@lawlex.com.au>
To: "'Velocity Users List'" <velocity-user@jakarta.apache.org>
Sent: jeudi 10 octobre 2002 01:52
Subject: RE: Map support in VTL


> > A slight variation to the above is to use the array syntax like this:
> >      #set( $myMap = $MapFactory.build(["one=1", "two=2", "three=3"]) )
> > 
> > The build method accepts an ArrayList and then iterates over it 
> > splitting each element on the first "=" putting the key and associated 
> > value into a HashMap.  Ought to be rather easy to implement if you 
> > assume all values are Strings.  No complicated parsing required.
> 
> That is very neat Bill!  I had forgotten that Velocity converts the string
> already into a List.  Velocity rocks.
> 
> > Attributes in XML/HTML tags are the same idea even though the Map isn't 
> > accessable.
> 
> Cool.  What I don't think I said properly, but what I meant is I haven't
> seen a language that supports the ability to create a Map-type-object and
> initialise it with values at declaration like you can with, as an example,
> an array in Java (.e.g String[] string = new String[]{"blah", "blah",
> "blah"};)  The syntax for doing something similar for a Map seems to be
> harder to read, and I wonder if that's why it's never been done.
> 
> Anyway, that Map idea you had Bill is cool, I think I'll have a use for
> that.  thanks.
> 
> Paul
> 
> --
> To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message