io.github.nichetoolkit.rest.helper.DeserializeHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest-toolkit-utils Show documentation
Show all versions of rest-toolkit-utils Show documentation
Rest toolkit utils project for Spring Boot
package io.github.nichetoolkit.rest.helper;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import io.github.nichetoolkit.rest.error.supply.JsonDeserializeException;
import java.io.IOException;
import java.util.*;
/**
* DeserializeHelper
* @author Cyan ([email protected])
* @version v1.0.0
*/
public class DeserializeHelper {
public static Map deserializerBean(JsonParser parser) throws JsonDeserializeException {
try {
JsonNode jsonNode = parser.getCodec().readTree(parser);
Map beanMap = new HashMap<>();
if (!jsonNode.isArray()) {
buildBeanMap(jsonNode, beanMap);
}
return beanMap;
} catch (IOException exception) {
throw new JsonDeserializeException(exception.getMessage());
}
}
public static List