Getters & Setters: Java
Boilerplate getters & setters - it's a tedious fact of life in Java, and probably the only thing that still pulls me back to an IDE. Perhaps someone knows a fast, pure vim way...
Start file
package com.vimgolf.challenge; public class Person { private String firstName; private String surname; private Integer age; }
End file
package com.vimgolf.challenge; public class Person { private String firstName; private String surname; private Integer age; public String getFirstName() { return firstName; } public void setFirstName( String firstName ) { this.firstName = firstName; } public String getSurname() { return surname; } public void setSurname( String surname ) { this.surname = surname; } public Integer getAge() { return age; } public void setAge( Integer age ) { this.age = age; } }
View Diff
6a7,21 > > public String getFirstName() { return firstName; } > public void setFirstName( String firstName ) { > this.firstName = firstName; > } > > public String getSurname() { return surname; } > public void setSurname( String surname ) { > this.surname = surname; > } > > public Integer getAge() { return age; } > public void setAge( Integer age ) { > this.age = age; > }
Solutions by @dstockwell:
Unlock 2 remaining solutions by signing in and submitting your own entry