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

dev.vality.testcontainers.annotations.util.ThriftUtil Maven / Gradle / Ivy

package dev.vality.testcontainers.annotations.util;

import com.fasterxml.jackson.databind.JsonNode;
import dev.vality.geck.serializer.kit.json.JsonHandler;
import dev.vality.geck.serializer.kit.json.JsonProcessor;
import dev.vality.geck.serializer.kit.tbase.TBaseHandler;
import dev.vality.geck.serializer.kit.tbase.TBaseProcessor;
import lombok.SneakyThrows;
import org.apache.thrift.TBase;

public class ThriftUtil {

    @SneakyThrows
    public static  JsonNode thriftToJson(T thrift) {
        return new TBaseProcessor().process(thrift, new JsonHandler());
    }

    @SneakyThrows
    public static  T jsonToThrift(JsonNode jsonNode, Class type) {
        return new JsonProcessor().process(jsonNode, new TBaseHandler<>(type));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy