next HTTP Client Implementation
up The Interpretation of Service Interfaces
previous Parameter Passing Modes
  Contents
PDF version   PostScript version


Method Prototype Extension Scheme

Having demonstrated the need for the extension of the Java method signature, in order to support both input and output parameters, we are left with the task of devising a suitable mechanism. In a non-reflective language, the solution would be likely to involve both a set of keywords (e.g. in and out) and a pre-processing phase during which these would be interpreted and removed--before the java compiler be invoked.
Java however offers a more elegant alternative using, once again, the reflective capabilities of the language.
Let us define the following scheme:
  1. the valid parameter passing modes are __in and __out
  2. for each function parameter, its mode must be appended to the function name
  3. modes must be specified in the same order as their corresponding parameter
  4. all input parameters must precede the first output parameter in the definition sequence
An example of such a method prototype is given in Table 4.1.

Table 4.1: Example of an extended method prototype
void getBookDetails__in__out__out(String isbn,String author,String title);


Parameter name Passing mode Parameter type
isbn input String
author output String
title output String


All method prototypes resulting from this scheme will be valid with respect to the Java language. No pre-processing stage is therefore required. The method name can be obtained by reflection, and parsed in order to reconcile the parameters with their respective passing mode. This is the role of the ModeQueueBuilder class (c.f. Figure B.2).


next HTTP Client Implementation
up The Interpretation of Service Interfaces
previous Parameter Passing Modes
  Contents

Copyright © 2001 Jean-Marc Rosengard