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

    // Extract the K, V of ImmutableMap<K, V>.
    TypeMirror keyType = getKeyType(typeMirror);
    TypeMirror valueType = getValueType(typeMirror);
    Serializer keyTypeSerializer = factory.getSerializer(keyType);
    Serializer valueTypeSerializer = factory.getSerializer(valueType);

    // We don't need this serializer if the K and V of ImmutableMap<K, V> are serializable.
    if (keyTypeSerializer.isIdentity() && valueTypeSerializer.isIdentity()) {
      return Optional.empty();
    }

    return Optional.of(
        new ImmutableMapSerializer(
            keyType, valueType, keyTypeSerializer, valueTypeSerializer, factory, processingEnv));
  }
A {@link SerializerExtension} that deserializes objects inside an {@link ImmutableMap}.

<p>Enables unserializable objects inside an ImmutableMap to be serializable.
value/src/main/java/com/google/auto/value/extension/serializable/serializer/impl/ImmutableMapSerializerExtension.java