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

io.quarkus.reactivemessaging.http.runtime.converters.JsonArrayConverter Maven / Gradle / Ivy

package io.quarkus.reactivemessaging.http.runtime.converters;

import java.lang.reflect.Type;

import jakarta.enterprise.context.ApplicationScoped;

import org.eclipse.microprofile.reactive.messaging.Message;

import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonArray;

/**
 * Converts message payload to {@link JsonArray}
 */
@ApplicationScoped
public class JsonArrayConverter extends JacksonBasedConverter {

    @Override
    public boolean canConvert(Message in, Type target) {
        return in.getPayload() instanceof Buffer && target == JsonArray.class;
    }

    @Override
    protected Message doConvert(Message in, Type target) {
        return in.withPayload(new JsonArray((Buffer) in.getPayload()));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy