[josm-dev] Jumbo Patch

Dave Hansen dave at sr71.net
Fri Dec 21 20:07:46 GMT 2007


On Sun, 2007-12-16 at 19:54 +0100, Gabriel Ebner wrote:
> 
> > Skimming over them using page-down, it's clear which ones are just 
> > "getFoo { return foo; }" and which are more complicated.
> 
> I'm perfectly OK with accessor functions that actually do something
> and that
> make the code clearer (and/or shorter).  But we're talking here about
> one-liners of the form:
> 
>   public int nrNodes() {
>     return nodes.size();
>   }
> 
> They just serve to enforce a certain access pattern. 

This:

class Way {
...
    private final List<Node> private_nodes = new ArrayList<Node>();
    public final List<Node> nodes = Collections.unmodifiableList(private_nodes);

is proving to be quite handy.  We could even make it so that developers
see the Collections.unmodifiableList() bits, but normal users don't.  

-- Dave





More information about the josm-dev mailing list