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

com.librato.metrics.reporter.Json Maven / Gradle / Ivy

Go to download

The LibratoReporter class runs in the background, publishing metrics to the Librato Metrics API at the specified interval.

The newest version!
package com.librato.metrics.reporter;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

public class Json {
    private static final ObjectMapper mapper = new ObjectMapper();

    public static String serialize(Object object) {
        try {
            return mapper.writeValueAsString(object);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static  T decode(String json, Class klazz) {
        try {
            return mapper.readValue(json, klazz);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy