Skip to content

Instantly share code, notes, and snippets.

@sejersbol
Created February 26, 2011 08:44
Show Gist options
  • Save sejersbol/845060 to your computer and use it in GitHub Desktop.
Save sejersbol/845060 to your computer and use it in GitHub Desktop.
With the Lombok annotation @DaTa this will generate code the shown here.
// Generated by delombok at Mon Feb 14 20:57:05 CET 2011
package com.example;
public class SomeDto {
private int id;
private String firstName;
private String lastName;
@java.lang.SuppressWarnings("all")
public SomeDto() {
}
@java.lang.SuppressWarnings("all")
public int getId() {
return this.id;
}
@java.lang.SuppressWarnings("all")
public String getFirstName() {
return this.firstName;
}
@java.lang.SuppressWarnings("all")
public String getLastName() {
return this.lastName;
}
@java.lang.SuppressWarnings("all")
public void setId(final int id) {
this.id = id;
}
@java.lang.SuppressWarnings("all")
public void setFirstName(final String firstName) {
this.firstName = firstName;
}
@java.lang.SuppressWarnings("all")
public void setLastName(final String lastName) {
this.lastName = lastName;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != this.getClass()) return false;
final SomeDto other = (SomeDto)o;
if (this.getId() != other.getId()) return false;
if (this.getFirstName() == null ? other.getFirstName() != null : !this.getFirstName().equals(other.getFirstName())) return false;
if (this.getLastName() == null ? other.getLastName() != null : !this.getLastName().equals(other.getLastName())) return false;
return true;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = result * PRIME + this.getId();
result = result * PRIME + (this.getFirstName() == null ? 0 : this.getFirstName().hashCode());
result = result * PRIME + (this.getLastName() == null ? 0 : this.getLastName().hashCode());
return result;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "SomeDto(id=" + this.getId() + ", firstName=" + this.getFirstName() + ", lastName=" + this.getLastName() + ")";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment