ec.gob.senescyt.sniese.commons.serializers.JSONFechaSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sniese-commons Show documentation
Show all versions of sniese-commons Show documentation
Librería que contiene clases de uso comun para sniese hechos en dropwizard
package ec.gob.senescyt.sniese.commons.serializers;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import ec.gob.senescyt.sniese.commons.Constantes;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.io.IOException;
public class JSONFechaSerializer extends JsonSerializer {
DateTimeFormatter fmt = DateTimeFormat.forPattern(Constantes.DATE_FORMAT).withZone(DateTimeZone.UTC);
@Override
public void serialize(DateTime date, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeString(date.toString(fmt));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy