Change getter/setter templates possible?

Is there a way to change the way the generated getters/setters look? I want my Collections to instantiate a new instance rather than return null, like so:

public ArrayList getFoo() {
if (_foo == null) {
_foo = new ArrayList(); // or whatever.
}
return _foo;
}

I understand this would only work if the type were a non-abstract, non-interface type, etc.

Please sign in to leave a comment.