cascading method calls on an object

Discussion in 'Java' started by =?ISO-8859-1?Q?Thomas_Gagn=E9?=, Jul 2, 2003.

  1. 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
    =?ISO-8859-1?Q?Thomas_Gagn=E9?=, Jul 2, 2003
    #1
    1. Advertising

  2. 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
    John C. Bollinger, Jul 2, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Honne Gowda A
    Replies:
    2
    Views:
    860
    Karl Heinz Buchegger
    Oct 31, 2003
  2. andy6
    Replies:
    2
    Views:
    750
    andy6 via DotNetMonster.com
    Jun 9, 2006
  3. Richard Tobin
    Replies:
    24
    Views:
    771
  4. cornelis van der bent

    cascading stdarg calls

    cornelis van der bent, Nov 27, 2009, in forum: C Programming
    Replies:
    3
    Views:
    350
    Seebs
    Nov 28, 2009
  5. Bob
    Replies:
    5
    Views:
    249
Loading...

Share This Page