Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of a class generated by Google AutoValue
package autovalue;
@javax.annotation.Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_EmployeeWithAutoValue extends EmployeeWithAutoValue {
private final String getName;
private final int getAge;
AutoValue_EmployeeWithAutoValue(
String getName,
int getAge) {
if (getName == null) {
throw new NullPointerException("Null getName");
}
this.getName = getName;
this.getAge = getAge;
}
@Override
public String getName() {
return getName;
}
@Override
public int getAge() {
return getAge;
}
@Override
public String toString() {
return "EmployeeWithAutoValue{"
+ "getName=" + getName
+ ", getAge=" + getAge
+ "}";
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof EmployeeWithAutoValue) {
EmployeeWithAutoValue that = (EmployeeWithAutoValue) o;
return (this.getName.equals(that.getName()))
&& (this.getAge == that.getAge());
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= getName.hashCode();
h *= 1000003;
h ^= getAge;
return h;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment