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

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

package io.github.kbachilo.jooq.converter;

import org.jooq.Converter;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Objects;

public class LocalDateTimeConverter implements Converter {

    public LocalDateTime from(Timestamp databaseObject) {
        return Objects.isNull(databaseObject) ? null : databaseObject.toLocalDateTime();
    }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy