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

com.zandero.rest.reader.JsonValueReader Maven / Gradle / Ivy

The newest version!
package com.zandero.rest.reader;

import com.zandero.utils.StringUtils;
import com.zandero.utils.extra.JsonUtils;
import io.vertx.core.json.jackson.DatabindCodec;

import javax.ws.rs.Consumes;

/**
 * Converts request body to JSON
 */
@Consumes("application/json")
public class JsonValueReader implements ValueReader {

    @Override
    public T read(String value, Class type) {

        if (StringUtils.isNullOrEmptyTrimmed(value)) {
            return null;
        }

        return JsonUtils.fromJson(value, type, DatabindCodec.mapper());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy