Or wait till 1.5 ;)

http://developer.java.sun.com/developer/community/chat/JavaLive/2003/jl0729.html

*Neal Gafter*: Then there's autoboxing/unboxing and varargs. Boxing allows you to use a primitive int instead of a |java.lang.Integer|, and unboxing does the reverse. varargs allows you to declare a method that takes a variable number of arguments, which are automatically packed up into an array before being passed to the method.


--m



Alex Shneyderman wrote:


You can make your parms Object []
This way you can pass as many params as you want.
Of course you will need to keep track of what element is what.

Maybe Java 1.5 will have the feature you are looking for :-)

Alex.



-----Original Message-----
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:51 PM
To: 'Struts Users Mailing List'
Subject: RE: Quick Java question..

sorry, dude, but param arguments are evaluated at compile time. The


best


you could do is overload the method.

Mark

-----Original Message-----
From: David Erickson [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:00 PM
To: Struts Mailing List
Subject: Quick Java question..


Hey as I've been building my actions I was thinking it could be useful


for


me to have a method that does some database querying, but I would like


to


give the user the ability to narrow down that query with as many input
fields as he needs. Is there a way to write a method that takes a


non-set


amount of arguments?  (Other than just passing the method a growable
array..
which is a viable alternative)

Ie

public String myfunction(String a, String b, String c.... on down the


line


indefinitly)

?
I thought I had seen this done somewhere somehow but I may be wrong.
Thanks!


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to