com.github.dts.sdk.util.JsonUtil Maven / Gradle / Ivy
package com.github.dts.sdk.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
public class JsonUtil {
private JsonUtil() {
}
public static ObjectReader objectReader() {
ObjectMapper objectMapper = new ObjectMapper();
return new ObjectReader() {
@Override
public T readValue(String json, Class type) throws IOException {
return objectMapper.readValue(json, type);
}
};
}
public interface ObjectReader {
T readValue(String json, Class type) throws IOException;
}
}