
io.lsn.spring.common.json.serializer.CustomTimestampSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Logisfera Nova Commons holds a bunch of useful helpers such as validators, conditional register
process, soap logging handler
The newest version!
package io.lsn.spring.common.json.serializer;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CustomTimestampSerializer extends JsonSerializer {
@Override
public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
jgen.writeString(formatter.format(value));
}
@Override
public void serializeWithType(Date value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
super.serializeWithType(value, gen, serializers, typeSer);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy