io.github.lc.oss.commons.serialization.InstantSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serialization Show documentation
Show all versions of serialization Show documentation
A common serializtion framework to help avoid accidental de/serializtion of object instances
The newest version!
package io.github.lc.oss.commons.serialization;
import java.io.IOException;
import java.time.Instant;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
public class InstantSerializer extends JsonSerializer {
@Override
public void serialize(Instant value, JsonGenerator gen, SerializerProvider serializer) throws IOException {
if (value == null) {
gen.writeNull();
} else {
gen.writeNumber(value.toEpochMilli());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy