All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.xml.bind.LenientLocalDateXmlAdapter Maven / Gradle / Ivy

package nl.vpro.xml.bind;

import lombok.extern.slf4j.Slf4j;

import java.time.format.DateTimeParseException;
import java.time.temporal.Temporal;

/**
 * As {@link LocalDateXmlAdapter}, only unparsable values will be unmarshalled to null
 * @author Michiel Meeuwissen
 * @since 2.4
 */
@Slf4j
public class LenientLocalDateXmlAdapter extends LocalDateXmlAdapter {

    @Override
    public Temporal unmarshal(String dateValue) {
        try {
            return super.unmarshal(dateValue);
        } catch (DateTimeParseException dte) {
            log.warn(dte.getMessage());
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy