You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Nathan Bubna <nb...@gmail.com> on 2006/01/02 20:22:50 UTC

Re: Java 5 enum

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 <gh...@weycogroup.com> wrote:
> > 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.
>
> Thanks, we'll wait for the next release to come out :)  Using toString() works
> for now, I just wanted to make sure that was the best way to handle this in the
> current version of Velocity.
>
> --
> ____________________________________________________________
> Glenn Holmer                          gholmer@weycogroup.com
> Software Engineer                        phone: 414.908.1809
> Weyco Group, Inc.                          fax: 414.908.1601
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

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


Re: Java 5 enum

Posted by Glenn Holmer <gh...@weycogroup.com>.
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 functionaly, but it's more Velocity-ish
> that way. :)

Thanks Nathan, that's exactly what we were looking for.

-- 
____________________________________________________________
Glenn Holmer                          gholmer@weycogroup.com
Software Engineer                        phone: 414-908-1809
Weyco Group, Inc.                          fax: 414-908-1601

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


Re: Java 5 enum

Posted by Will Glass-Husain <wg...@forio.com>.
Oh, that's nice.  Never occurred to me...

WILL

----- Original Message ----- 
From: "Nathan Bubna" <nb...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Monday, January 02, 2006 11:22 AM
Subject: Re: Java 5 enum


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 <gh...@weycogroup.com> wrote:
> > 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.
>
> Thanks, we'll wait for the next release to come out :)  Using toString() 
> works
> for now, I just wanted to make sure that was the best way to handle this 
> in the
> current version of Velocity.
>
> --
> ____________________________________________________________
> Glenn Holmer                          gholmer@weycogroup.com
> Software Engineer                        phone: 414.908.1809
> Weyco Group, Inc.                          fax: 414.908.1601
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

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


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