Top Description Methods
com.google.auto.value

public @Interface AutoBuilder

extends Annotation
Annotations
@Retention:CLASS
@Target:TYPE
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

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

Method Summary

Modifier and TypeMethod and Description
public String
callMethod()

The static method from ofClass to call when the build-method of the builder is called.

public Class<?>
ofClass()

The class or interface containing the constructor or static method that the generated builder will eventually call.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

callMethodback to summary
public String callMethod()

The static method from ofClass 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.

ofClassback to summary
public 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.