String generate() {

      TypeSpec.Builder generated =
          classBuilder(className)
              .superclass(superType())
              .addAnnotations(
                  context.classAnnotationsToCopy(context.autoValueClass()).stream()
                      .map(AnnotationSpec::get)
                      .collect(toImmutableList()))
              .addTypeVariables(annotatedTypeVariableNames())
              .addModifiers(isFinal ? FINAL : ABSTRACT)
              .addMethod(constructor());
      generatedAnnotationSpec(elements, sourceVersion, MemoizeExtension.class)
          .ifPresent(generated::addAnnotation);

      for (ExecutableElement method : memoizedMethods(context)) {
        MethodOverrider methodOverrider = new MethodOverrider(method);
        generated.addFields(methodOverrider.fields());
        generated.addMethod(methodOverrider.method());
      }
      if (isHashCodeMemoized() && !isEqualsFinal()) {
        generated.addMethod(equalsWithHashCodeCheck());
      }
      if (hasErrors) {
        return null;
      }
      return JavaFile.builder(context.packageName(), generated.build()).build().toString();
    }
An extension that implements the {@link com.google.auto.value.extension.memoized.Memoized}
contract.
value/src/main/java/com/google/auto/value/extension/memoized/processor/MemoizeExtension.java