DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Haikal has posted 8 posts at DZone. View Full User Profile

Flesh Out Your Builder With Vim.

  • submit to reddit
        Create 'setters' for builder methods with vim. On each line, place 'type varname:
int foo
string bar

%s:\(\w\+\) \(\w\+\):public ClassIdBuilder \2(\1 value) {this.\2 = value; return this;}:

Copy assignments from builder to type. Each line is a variable name.
:%s:\(\w\+\):this.\1 = builder.\1;: