io.github.eduardromanyuk.turbosms.json.LocalDateTimeSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of turbosms-spring-boot-starter Show documentation
Show all versions of turbosms-spring-boot-starter Show documentation
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.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class LocalDateTimeSerializer extends StdSerializer {
protected LocalDateTimeSerializer() {
super(LocalDateTime.class);
}
@Override
public void serialize(LocalDateTime value, JsonGenerator json, SerializerProvider provider) throws IOException {
json.writeString(value.format(DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm")));
}
}