Re: Java 5 enum

2006-01-03 Thread Glenn Holmer
On Monday 02 January 2006 13:22, Nathan Bubna wrote: > personally, i would avoid the explicit toString() call and do this: > > #if ("$userType" == "salesman") > ## do salesman stuff > #elseif ("$userType" == "customer") > ## do customer stuff > #end Oh, duhhh... > i know it's the same thing fun

Re: Java 5 enum

2006-01-02 Thread Will Glass-Husain
Oh, that's nice. Never occurred to me... WILL - Original Message - From: "Nathan Bubna" <[EMAIL PROTECTED]> To: "Velocity Users List" Sent: Monday, January 02, 2006 11:22 AM Subject: Re: Java 5 enum personally, i would avoid the explicit to

Re: Java 5 enum

2006-01-02 Thread Nathan Bubna
personally, i would avoid the explicit toString() call and do this: #if ("$userType" == "salesman") ## do salesman stuff #elseif ("$userType" == "customer") ## do customer stuff #end i know it's the same thing functionaly, but it's more Velocity-ish that way. :) On 12/31/05, Glenn Holmer <[EMA

Re: Java 5 enum

2005-12-31 Thread Glenn Holmer
> Have you tried this with the latest from source code head? (unreleased > version 1.5). Equality for items of different classes is now based on the > toString automatically. > http://issues.apache.org/jira/browse/VELOCITY-350 > > I haven't tried this with Java 5 enums, but I'd think this woul

Re: Java 5 enum

2005-12-30 Thread Andrew Mason
There may be a velocity tool to do this, but it may also be better implementing the logic in the java file instead... ie just include a different String template_name depending on the enum value in the back end and #parse("$template_name"); On Thursday 29 December 2005 21:58, Michael Heuer wro

Re: Java 5 enum

2005-12-29 Thread Will Glass-Husain
Have you tried this with the latest from source code head? (unreleased version 1.5). Equality for items of different classes is now based on the toString automatically. http://issues.apache.org/jira/browse/VELOCITY-350 I haven't tried this with Java 5 enums, but I'd think this would work. WI

Re: Java 5 enum

2005-12-29 Thread Michael Heuer
Glenn Holmer wrote: > We're considering holding a session variable as a Java 5 "enum", in > which case it looks like we'd have to test its toString() value to > branch on it in a Velocity template, e.g. > > #if ($userType.toString() == "salesman") > ## do salesman stuff > #elseif ($userType.toS