velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Heuer <heue...@acm.org>
Subject Re: Just a small issue...
Date Thu, 03 Jun 2004 22:29:38 GMT

In the there-should-be-a-tool-to-do-this category but with the caveat that
I haven't looked at any of the Tool APIs, it would be nice to have:

  upper("FooBar") --> "FooBar"
  sentence("FooBar") --> "Foo bar"
  mixed("FooBar") --> "fooBar"
  lower("FooBar") --> "foo bar"

or similar method names for code generation purposes.

   michael


On Thu, 3 Jun 2004, Nathan Green wrote:

> This isn't ideal, but I think it will work...
>
> #set ($attributeList = ["firstName", "dob"])
> #set ($attributeMethods = ["FirstName", "Dob"])
> #set ($typeList = ["String","Timestamp"] )
>
> #set ($i = 0)
> #foreach($attribute in $attributeList)
> public $typeList.get(i) get$attributeMethods.get(i){
> 	return $(attribute);
> }
> #set ($i = $i + 1)
> #end
>
> There might be a couple syntax issues in there, but
> those shouldn't be too hard to track down.  I'm too
> busy now to think of a better way to do this, sorry.
>
> Nathan
>
>
> Vijay Bala wrote:
>
> > Hi there!
> >
> > When I work with velocity I find it so incredible and
> > I do really enjoy working with it.
> >
> > I just find the following issue while working with it.
> > Please clarify me what to do.
> >
> > First, I declare
> >
> > #set ($attributeList = ["firstName", "dob"])
> > #set ($typeList = ["String","TimeStamp"] )
> >
> > and then I try to create getters and setters for these
> > attributes like...
> >
> >
> > foreach($attribute in $attributeList)
> > set ($i = 0)
> >  public $typeList.get(i) get$attribute{
> >    	    return $(attribute);
> > 	}
> >  }
> > set ($i = $i +1)
> > #end
> >
> > When I get the output, I get like this....
> >
> > public String getfirstName(){
> >     return firstName;
> > }
> >
> > Well my issue is I do need to have the "getter" to be
> > named as "getFirstName()" instead of getfirstName.
> > Please explain me how to achive getting the first
> > letter Capital on the method name.(like
> > get(F)irstName)
> >
> >
> > Thanks in advance.
> > -Vijay
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Friends.  Fun.  Try the all-new Yahoo! Messenger.
> > http://messenger.yahoo.com/
> >
> > ---------------------------------------------------------------------
> > 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


Mime
View raw message