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

io.github.eduardromanyuk.turbosms.json.LocalDateTimeDeserializer Maven / Gradle / Ivy

Go to download

This starter provides infrastructure for using TurboSMS sms/viber provider. HTTP API was used for communication.

The newest version!
package io.github.eduardromanyuk.turbosms.json;

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

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class LocalDateTimeDeserializer extends StdDeserializer {
	protected LocalDateTimeDeserializer() {
		super(LocalDateTime.class);
	}

	@Override
	public LocalDateTime deserialize(JsonParser jp, DeserializationContext deserializationContext) throws IOException {
		return LocalDateTime.parse(
				jp.getCodec().readValue(jp, String.class),
				DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
		);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy