mx.emite.sdk.utils.LocalDateTimeAdapter 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.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.apache.commons.lang3.StringUtils;
public class LocalDateTimeAdapter extends XmlAdapter {
private static final DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss",new Locale("es","MX"));
@Override
public LocalDateTime unmarshal(String date) throws Exception {
if(StringUtils.isEmpty(date))
return null;
return LocalDateTime.parse(date,df);
}
@Override
public String marshal(LocalDateTime date) throws Exception {
if(date==null)
return null;
return df.format(date);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy