@Override
  public Optional<Serializer> getSerializer(
      TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) {
    if (!isOptional(typeMirror)) {
      return Optional.empty();
    }

    // Extract the T of Optional<T>.
    TypeMirror containedType = getContainedType(typeMirror);
    Serializer containedTypeSerializer = factory.getSerializer(containedType);

    return Optional.of(new OptionalSerializer(containedTypeSerializer));
  }
Creates a {@link Serializer} that supports {@link Optional} types.
value/src/main/java/com/google/auto/value/extension/serializable/serializer/impl/OptionalSerializerExtension.java