peichhorn / lombok-pg

Collection of lombok extensions
http://peichhorn.github.com/lombok-pg/
Other
326 stars 44 forks source link

add unbuild to @builder #140

Open dabraham02124 opened 11 years ago

dabraham02124 commented 11 years ago

In addition to all the neat stuff in the @Builder annotation, could you please add an unbuild method? This would create a builder based on the object in question. Thus if object personName1 has firstName = "John" and lastName = "Smith" you could do this:

personName2 = personName1.unbuild().lastName("Johnson").build();

yielding personName2 with firstName = "John" and lastName = "Johnson"

Also you could implement clone() pretty directly from this if you wanted.

benmccann commented 11 years ago

+1 (though I'd prefer that the method be named builder())

dabraham02124 commented 11 years ago

That makes sense. I'd been reasoning by contrast with build(), but this method would be on the actual object, not the builder, so that makes sense to me.