
com.librato.metrics.reporter.Json Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metrics-librato Show documentation
Show all versions of metrics-librato Show documentation
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