Skip to content

Instantly share code, notes, and snippets.

@mroger
Last active August 29, 2015 14:19
Show Gist options
  • Save mroger/4b28e7fdb197d60a088e to your computer and use it in GitHub Desktop.
Save mroger/4b28e7fdb197d60a088e to your computer and use it in GitHub Desktop.
Showing class not annotaded with Lombok and with boiler plate code.
import java.util.Date;
public class PersonBoilerPlateCode {
private String name;
private String lastName;
private Date dateOfBirth;
private String address;
public PersonBoilerPlateCode() {
super();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "PersonBoilerPlateCode [address=" + address + ", dateOfBirth="
+ dateOfBirth + ", lastName=" + lastName + ", name=" + name
+ "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result
+ ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
result = prime * result
+ ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PersonBoilerPlateCode other = (PersonBoilerPlateCode) obj;
if (address == null) {
if (other.address != null)
return false;
} else if (!address.equals(other.address))
return false;
if (dateOfBirth == null) {
if (other.dateOfBirth != null)
return false;
} else if (!dateOfBirth.equals(other.dateOfBirth))
return false;
if (lastName == null) {
if (other.lastName != null)
return false;
} else if (!lastName.equals(other.lastName))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment