mx.emite.sdk.utils.FechaSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ef-sdk-java Show documentation
Show all versions of ef-sdk-java Show documentation
Este kit de consumo provee a los integradores de Apis de Java para construir software que consuma los diferentes servicios web publicados por Emite Facturacion
package mx.emite.sdk.utils;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
public class FechaSerializer extends JsonSerializer{
private static final DateTimeFormatter df = DateTimeFormatter.ofPattern("dd/MM/yyyy",new Locale("es","MX"));
@Override
public void serialize(LocalDate date, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonProcessingException {
if(date==null)
gen.writeNull();
gen.writeString(df.format(date));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy