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

io.vrap.rmf.base.client.ResponseSerializer Maven / Gradle / Ivy

There is a newer version: 17.17.0
Show newest version

package io.vrap.rmf.base.client;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;

import io.vrap.rmf.base.client.utils.json.JsonUtils;

/**
 * Interface to deserialize a response to a specified output type
 */
public interface ResponseSerializer {
     ApiHttpResponse convertResponse(final ApiHttpResponse response, final Class outputType);

     ApiHttpResponse convertResponse(final ApiHttpResponse response, final JavaType outputType);

     ApiHttpResponse convertResponse(final ApiHttpResponse response, final TypeReference outputType);

    byte[] toJsonByteArray(final Object value) throws JsonProcessingException;

    static ResponseSerializer of() {
        return new ResponseSerializerImpl(JsonUtils.getConfiguredObjectMapper());
    }

    static ResponseSerializer of(final ObjectMapper mapper) {
        return new ResponseSerializerImpl(mapper);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy