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

com.englishtown.vertx.jersey.features.jackson.internal.JsonArraySerializer Maven / Gradle / Ivy

There is a newer version: 4.7.0
Show newest version
package com.englishtown.vertx.jersey.features.jackson.internal;

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 io.vertx.core.json.JsonArray;

import java.io.IOException;

/**
 * Jackson serializer for Vert.x {@link JsonArray}
 */
public class JsonArraySerializer extends JsonSerializer {
    /**
     * Method that can be called to ask implementation to serialize
     * values of type this serializer handles.
     *
     * @param value       Value to serialize; can not be null.
     * @param gen         Generator used to output resulting Json content
     * @param serializers Provider that can be used to get serializers for
     */
    @Override
    public void serialize(JsonArray value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
        gen.writeObject(value.getList());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy