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

com.plivo.api.serializers.MapToCommaListSerializer Maven / Gradle / Ivy

Go to download

A Java SDK to make voice calls & send SMS using Plivo and to generate Plivo XML

There is a newer version: 5.44.3
Show newest version
package com.plivo.api.serializers;

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;
import java.util.Map.Entry;

public class MapToCommaListSerializer extends JsonSerializer> {

  @Override
  public void serialize(Map value, JsonGenerator gen,
    SerializerProvider serializers)
    throws IOException, JsonProcessingException {
    StringBuilder sb = new StringBuilder();
    for (Entry entry : value.entrySet()) {
      sb.append(entry.getKey())
        .append("=")
        .append(entry.getValue())
        .append(",");
    }
    gen.writeString(sb.toString());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy