package org.apache.logging.log4j.core.jackson;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

public class ListOfMapEntrySerializer extends StdSerializer<Map> {
   protected ListOfMapEntrySerializer() {
      super(Map.class);
   }

   public void serialize(Map map, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
      Set<Entry<String, String>> entrySet = map.entrySet();
      MapEntry[] pairs = new MapEntry[entrySet.size()];
      int i = 0;

      Entry entry;
      for(Iterator i$ = entrySet.iterator(); i$.hasNext(); pairs[i++] = new MapEntry((String)entry.getKey(), (String)entry.getValue())) {
         entry = (Entry)i$.next();
      }

      jgen.writeObject(pairs);
   }
}
