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

cloud.genesys.webmessaging.sdk.LocalDateDeserializer Maven / Gradle / Ivy

package cloud.genesys.webmessaging.sdk;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

import java.io.IOException;
import java.time.LocalDate;

public class LocalDateDeserializer extends StdDeserializer {
    public LocalDateDeserializer() {
        this(null);
    }

    public LocalDateDeserializer(Class t) {
        super(t);
    }

    @Override
    public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
        JsonNode node = jp.getCodec().readTree(jp);
        String text = node.asText();
        return LocalDate.parse(text);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy