Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 925 Bytes

File metadata and controls

38 lines (27 loc) · 925 Bytes

AutoValue: Custom hashCode/equals Extension

An extension for Google's AutoValue that allows for the exclusion of specific properties from hashCode and equals

Usage

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
}

Download

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]"
}