@Retention(value=SOURCE) @Target(value=TYPE) public @interface AutoValue
Object
methods like
equals
to have conventional value semantics. A simple example: @AutoValue abstract class Person { static Person create(String name, int id) { return new AutoValue_Person(name, id); } abstract String name(); abstract int id(); }
Modifier and Type | Optional Element and Description |
---|---|
boolean |
cacheHashCode
Specifies whether the generated class should cache each instance's
hashCode value in a field once it is first computed. |
public abstract boolean cacheHashCode
hashCode
value in a field once it is first computed. Note: most classes should have
no need of this behavior and should omit this parameter entirely. Use only if certain of its
performance benefit to your application.
Warning: while using mutable field types is strongly discouraged in general, using this feature makes it especially dangerous.
Copyright © 2014 Google, Inc.. All Rights Reserved.