Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   cascading method calls on an object (http://www.velocityreviews.com/forums/t123983-cascading-method-calls-on-an-object.html)

=?ISO-8859-1?Q?Thomas_Gagn=E9?= 07-02-2003 06:50 PM

cascading method calls on an object
 
Is there a way to cascade methods on an object similar to Smalltalk's cascading?

In Smalltalk (server pages) I might:

session
at: #username put: (request getParameterValueAt: 'username');
at: #server put: (request getParameterValueAt: 'server');
at: #password put: (request getParameterValueAt: 'password');
at: #database put: (request getParameterValueAt: 'database').

In Java (server pages) I think I can only:

session setAttribute("username", request.getParameter("username");
session setAttribute("server", request.getParameter("server");
session setAttribute("password", request.getParameter("password");
session setAttribute("database", request.getParameter("database");

--
..tom
remove dashes in email for replies
http://isectd.sourceforge.net


John C. Bollinger 07-02-2003 10:36 PM

Re: cascading method calls on an object
 
Thomas Gagné wrote:
> Is there a way to cascade methods on an object similar to Smalltalk's
> cascading?
>
> In Smalltalk (server pages) I might:
>
> session
> at: #username put: (request getParameterValueAt: 'username');
> at: #server put: (request getParameterValueAt: 'server');
> at: #password put: (request getParameterValueAt: 'password');
> at: #database put: (request getParameterValueAt: 'database').
>
> In Java (server pages) I think I can only:
>
> session setAttribute("username", request.getParameter("username");
> session setAttribute("server", request.getParameter("server");
> session setAttribute("password", request.getParameter("password");
> session setAttribute("database", request.getParameter("database");
>


You are correct in your analysis: Java has no syntax for what you want
to do. Some methods of some objects allow you to do this though -- see,
for instance, StringBuffer.append.


John Bollinger
jobollin@indiana.edu



All times are GMT. The time now is 09:56 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.