io.github.nichetoolkit.rest.util.DeserializeUtils 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
The newest version!
package io.github.nichetoolkit.rest.util;
import com.fasterxml.jackson.core.JsonParser;
import io.github.nichetoolkit.rest.error.supply.JsonDeserializeException;
import io.github.nichetoolkit.rest.helper.DeserializeHelper;
import lombok.extern.slf4j.Slf4j;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* DeserializeUtils
* The deserialize utils class.
* @author Cyan ([email protected])
* @see lombok.extern.slf4j.Slf4j
* @since Jdk1.8
*/
@Slf4j
public class DeserializeUtils {
/**
* deserializerBean
* The deserializer bean method.
* @param parser {@link com.fasterxml.jackson.core.JsonParser} The parser parameter is JsonParser
type.
* @return {@link java.util.Map} The deserializer bean return object is Map
type.
* @see com.fasterxml.jackson.core.JsonParser
* @see java.util.Map
*/
public static Map deserializerBean(JsonParser parser) {
try {
return DeserializeHelper.deserializerBean(parser);
} catch (JsonDeserializeException exception) {
log.error("It is failed during json to deserialize as map of bean fields! {}", exception.getMessage());
GeneralUtils.printStackTrace(exception);
}
return Collections.emptyMap();
}
/**
* deserializerList
* The deserializer list method.
* @param parser {@link com.fasterxml.jackson.core.JsonParser} The parser parameter is JsonParser
type.
* @return {@link java.util.List} The deserializer list return object is List
type.
* @see com.fasterxml.jackson.core.JsonParser
* @see java.util.List
*/
public static List