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

org.opensearch.migrations.utils.TrackedFutureJsonFormatter Maven / Gradle / Ivy

The newest version!
package org.opensearch.migrations.utils;

import java.util.function.Function;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Lombok;
import lombok.NonNull;

public class TrackedFutureJsonFormatter {

    static ObjectMapper objectMapper = new ObjectMapper();

    private TrackedFutureJsonFormatter() {}

    public static  String format(TrackedFuture tf) {
        return format(tf, x -> null);
    }

    public static  String format(
        TrackedFuture tf,
        @NonNull Function, String> resultFormatter
    ) {
        try {
            return objectMapper.writeValueAsString(TrackedFutureMapConverter.makeJson(tf, resultFormatter));
        } catch (Exception e) {
            throw Lombok.sneakyThrow(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy