ca.qhrtech.utilities.LocalDateTimeDeserializer.java Source code

Java tutorial

Introduction

Here is the source code for ca.qhrtech.utilities.LocalDateTimeDeserializer.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ca.qhrtech.utilities;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
import java.time.LocalDateTime;

/**
 *
 * @author bryan
 */
public class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {

    @Override
    public LocalDateTime deserialize(JsonParser jp, DeserializationContext dc)
            throws IOException, JsonProcessingException {
        return LocalDateTime.parse(jp.getText());
    }

}