All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.emm035.openapi.immutables.v3.content.ContentSerializer Maven / Gradle / Ivy

package io.github.emm035.openapi.immutables.v3.content;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.util.Map;

class ContentSerializer extends JsonSerializer {
  @Override
  public void serialize(Content value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
    gen.writeStartObject();
    for (Map.Entry entry : value.getMediaTypes().entrySet()) {
      gen.writeObjectField(entry.getKey(), entry.getValue());
    }
    for (Map.Entry entry : value.getExtensions().entrySet()) {
      gen.writeObjectField(entry.getKey(), entry.getValue());
    }
    gen.writeEndObject();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy