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

nl.vpro.rs.converters.LocalDateParamConverter Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package nl.vpro.rs.converters;

import java.time.LocalDate;

import jakarta.ws.rs.ext.ParamConverter;


/**
 * @author Michiel Meeuwissen
 * @since 0.25
 */
public class LocalDateParamConverter implements ParamConverter {

    static LocalDateParamConverter INSTANCE = new LocalDateParamConverter();

    @Override
    public LocalDate fromString(String value) {
        if (value == null || value.isEmpty()) {
            return null;
        }
        return LocalDate.parse(value);
    }

    @Override
    public String toString(LocalDate value) {
        if (value == null) {
           return null;
        }
        return value.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy