Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Cake.java
CartItem.java
README.md

README.md

AutoValue

Demo of Item 10 from EffectiveJava 3/E.

All objects must obey general contract when overriding equals. AutoValue from Google saves the programmer from writing custom equals and hashCode implementations. IDEs can generate implementations, but they're fragile -- and not future-proof. AutoValue annotation is a smarter approach, therefore.

Note:

  • all the value objects are immutable.
  • in Cake, since flour and bakingPowder are required properties, the only way to build a cake is by supplying these properties to Builder.

See:

  1. AutoValue introduction: https://github.com/google/auto/blob/master/value/userguide/index.md
  2. AutoValue Builder: https://github.com/google/auto/blob/master/value/userguide/builders.md
You can’t perform that action at this time.