PROPOSAL: Named method parameters

howard.lovatt at howard.lovatt at
Tue Apr 21 17:52:59 PDT 2009

I use the builder pattern successfully via my enhanced compiler ( pet  
project :) ):

and in particular:

The enhanced compiler enforces the pattern, ie if you get it wrong the  
compiler gives you an error message.

You can also use a simple structure like class, eg:

class Point {

static class Args {
int x = 0;
int y = 0;

final int x;

final iny y;

Point( Args args ) {
x = args.x;
y = args.y;



Which is used like:

Point p = new Point( new Point.Args() {{ x = 1; }} );

As the original post said you would only use this if there were a lot of  
arguments, therefore the overhead of typing "new Point.Args() {{ }}" is  

-- Howard.

More information about the coin-dev mailing list