All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.nichetoolkit.rest.util.DeserializeUtils Maven / Gradle / Ivy

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 deserializerList(JsonParser parser) { try { return DeserializeHelper.deserializerList(parser); } catch (JsonDeserializeException exception) { log.error("It is failed during json to deserialize as list of bean! {}", exception.getMessage()); GeneralUtils.printStackTrace(exception); } return Collections.emptyList(); } /** * deserializerBeanList *

The deserializer bean list method.

* @param parser {@link com.fasterxml.jackson.core.JsonParser}

The parser parameter is JsonParser type.

* @return {@link java.util.List}

The deserializer bean list return object is List type.

* @see com.fasterxml.jackson.core.JsonParser * @see java.util.List */ public static List> deserializerBeanList(JsonParser parser) { try { return DeserializeHelper.deserializerBeanList(parser); } catch (JsonDeserializeException exception) { log.error("It is failed during json to deserialize as list map of bean fields! {}", exception.getMessage()); GeneralUtils.printStackTrace(exception); } return Collections.emptyList(); } /** * deserializerMap *

The deserializer map method.

* @param parser {@link com.fasterxml.jackson.core.JsonParser}

The parser parameter is JsonParser type.

* @return {@link java.util.Map}

The deserializer map return object is Map type.

* @see com.fasterxml.jackson.core.JsonParser * @see java.util.Map */ public static Map deserializerMap(JsonParser parser) { try { return DeserializeHelper.deserializerMap(parser); } catch (JsonDeserializeException exception) { log.error("It is failed during json to deserialize as map of bean! {}", exception.getMessage()); GeneralUtils.printStackTrace(exception); } return Collections.emptyMap(); } /** * deserializerBeanMap *

The deserializer bean map method.

* @param parser {@link com.fasterxml.jackson.core.JsonParser}

The parser parameter is JsonParser type.

* @return {@link java.util.Map}

The deserializer bean map return object is Map type.

* @see com.fasterxml.jackson.core.JsonParser * @see java.util.Map */ public static Map> deserializerBeanMap(JsonParser parser){ try { return DeserializeHelper.deserializerBeanMap(parser); } catch (JsonDeserializeException exception) { log.error("It is failed during json to deserialize as map map of bean fields! {}", exception.getMessage()); GeneralUtils.printStackTrace(exception); } return Collections.emptyMap(); } }