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

io.github.kbachilo.jooq.converter.LocalDateConverter Maven / Gradle / Ivy

package io.github.kbachilo.jooq.converter;

import org.jooq.Converter;

import java.sql.Date;
import java.time.LocalDate;
import java.util.Objects;

public class LocalDateConverter implements Converter {

    public LocalDate from(Date databaseObject) {
        return Objects.isNull(databaseObject) ? null : databaseObject.toLocalDate();
    }

    public Date to(LocalDate userObject) {
        return Objects.isNull(userObject) ? null : Date.valueOf(userObject);
    }

    public Class fromType() {
        return Date.class;
    }

    public Class toType() {
        return LocalDate.class;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy