An extension for Google's AutoValue that allows for the exclusion of specific properties from hashCode and equals
Annotate any properties in your @AutoValue
-annotated class with
@IgnoreForHashCodeEquals
@AutoValue public abstract class Foo {
public abstract String bar();
@IgnoreForHashCodeEquals public abstract UUID id(); // will not be used in generating hashCode and equals
}
Add JitPack at the end of your list of repositories if you haven't already:
repositories {
... // jcenter(), mavenCentral(), etc
maven { url "https://jitpack.io" }
}
Now add the dependencies:
dependencies {
compileOnly "com.github.kevinmost.auto-value-custom-hashcode-equals:adapter:[version]"
apt "com.github.kevinmost.auto-value-custom-hashcode-equals:processor:[version]"
}