Annotation Type AutoValue.Builder


  • @Retention(CLASS)
    @Target(TYPE)
    public static @interface AutoValue.Builder
    Specifies that AutoValue should generate an implementation of the annotated class or interface, to serve as a builder for the value-type class it is nested within. As a simple example, here is an alternative way to write the Person class mentioned in the AutoValue example:
       @AutoValue
       abstract class Person {
         static Builder builder() {
           return new AutoValue_Person.Builder();
         }
    
         abstract String name();
         abstract int id();
    
         @AutoValue.Builder
         interface Builder {
           Builder name(String x);
           Builder id(int x);
           Person build();
         }
       }
    Author:
    Éamonn McManus