private CodeBlock format(CodeBlock propertyAccess, CodeBlock indentAccess, TypeMirror type) {
      PrettyPrintableKind printableKind = type.accept(new KindVisitor(types, elements), null);
      DelegateMethod delegateMethod = new DelegateMethod(propertyAccess, indentAccess);
      switch (printableKind) {
        case PRIMITIVE:
          return propertyAccess;
        case REGULAR_OBJECT:
          return delegateMethod
              .methodName("format")
              .invocation(
                  elements.getTypeElement("java.lang.Object").asType(), () -> reindent("toString"));
        case HAS_TO_PRETTY_STRING_METHOD:
          ExecutableElement method =
              toPrettyStringMethod(asTypeElement(type), types, elements).get();
          return delegateMethod.invocation(type, () -> reindent(method.getSimpleName()));
        case ARRAY:
          TypeMirror componentType = MoreTypes.asArray(type).getComponentType();
          return delegateMethod.invocation(type, () -> forEachLoopMethodBody(componentType));
        case COLLECTION:
          TypeMirror elementType =
              getOnlyElement(resolvedTypeParameters(type, "java.util.Collection"));
          return delegateMethod.invocation(
              collectionOf(elementType), () -> forEachLoopMethodBody(elementType));
        case IMMUTABLE_PRIMITIVE_ARRAY:
          return delegateMethod.invocation(type, this::forLoopMethodBody);
        case OPTIONAL:
        case GUAVA_OPTIONAL:
          TypeMirror optionalType = getOnlyElement(MoreTypes.asDeclared(type).getTypeArguments());
          return delegateMethod.invocation(
              type, () -> optionalMethodBody(optionalType, printableKind));
        case MAP:
          return formatMap(type, delegateMethod);
        case MULTIMAP:
          return formatMultimap(type, delegateMethod);
      }
      throw new AssertionError(printableKind);
    }
Returns {@code propertyAccess} formatted for use within the {@link
com.google.auto.value.extension.toprettystring.ToPrettyString} implementation.

<p>If a helper method is necessary for formatting, a {@link MethodSpec} will be added to
{@link #delegateMethods}.

@param propertyAccess a reference to the variable that should be formatted.
@param indentAccess a reference to an {@code int} representing how many indent levels should
    be used for this property.
@param type the type of the {@code propertyAccess}.
value/src/main/java/com/google/auto/value/extension/toprettystring/processor/ToPrettyStringExtension.java