Package com.google.auto.value
Annotation Type AutoBuilder
-
@Retention(CLASS) @Target(TYPE) public @interface AutoBuilder
Specifies that the annotated interface or abstract class should be implemented as a builder.A simple example:
@
AutoBuilder(ofClass = Person.class) abstract class PersonBuilder { static PersonBuilder builder() { return new AutoBuilder_PersonBuilder(); } abstract PersonBuilder setName(String name); abstract PersonBuilder setId(int id); abstract Person build(); }- See Also:
- AutoBuilder User's Guide
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String
callMethod
The static method fromofClass()
to call when the build-method of the builder is called.Class<?>
ofClass
The class or interface containing the constructor or static method that the generated builder will eventually call.
-
-
-
Element Detail
-
callMethod
String callMethod
The static method fromofClass()
to call when the build-method of the builder is called. By default this is empty, meaning that a constructor rather than a static method should be called. There can be more than one method with the given name, or more than one constructor, in which case the one to call is the one whose parameter names and types correspond to the abstract methods of the class or interface with the@AutoBuilder
annotation.- Default:
- ""
-
-
-
ofClass
Class<?> ofClass
The class or interface containing the constructor or static method that the generated builder will eventually call. By default this is the class or interface that contains the class or interface with the@AutoBuilder
annotation.- Default:
- java.lang.Void.class
-
-