rename packages and classes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
26
src/main/java/wtf/beatrice/releasehive/utils/JsonUtil.java
Normal file
26
src/main/java/wtf/beatrice/releasehive/utils/JsonUtil.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package wtf.beatrice.releasehive.utils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class JsonUtil
|
||||
{
|
||||
|
||||
private JsonUtil() {
|
||||
throw new AssertionError("Utility class");
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(JsonUtil.class);
|
||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
|
||||
public static String convertToJson(Object input) {
|
||||
try {
|
||||
return MAPPER.writeValueAsString(input);
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error(e);
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user