Optional<Builder> getBuilder() {
    Optional<TypeElement> builderTypeElement = Optional.empty();
    for (TypeElement containedClass : typesIn(autoValueClass.getEnclosedElements())) {
      if (hasAnnotationMirror(containedClass, AUTO_VALUE_BUILDER_NAME)) {
        findBuilderError(containedClass)
            .ifPresent(error -> errorReporter.reportError(containedClass, "%s", error));
        if (builderTypeElement.isPresent()) {
          errorReporter.reportError(
              containedClass,
              "[AutoValueTwoBuilders] %s already has a Builder: %s",
              autoValueClass,
              builderTypeElement.get());
        } else {
          builderTypeElement = Optional.of(containedClass);
        }
      }
    }

    if (builderTypeElement.isPresent()) {
      return builderFrom(builderTypeElement.get());
    } else {
      return Optional.empty();
    }
  }
Determines if the {@code @AutoValue} class for this instance has a correct nested
{@code @AutoValue.Builder} class or interface and return a representation of it in an {@code
Optional} if so.
value/src/main/java/com/google/auto/value/processor/BuilderSpec.java