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

nl.vpro.domain.EmbargoBuilder Maven / Gradle / Ivy

Go to download

Several domains like 'media', pages' and 'subtitles' in the POMS system share some common properties which are collected here

There is a newer version: 8.3.0
Show newest version
package nl.vpro.domain;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

import nl.vpro.util.DateUtils;

import static nl.vpro.util.DateUtils.toDate;

/**
 * @author Michiel Meeuwissen
 * @since 5.3
 */
public interface EmbargoBuilder> {

    ZoneId ZONE_ID = ZoneId.of("Europe/Amsterdam");


    @Deprecated
    default B publishStart(Date date) {
        return publishStart(DateUtils.toInstant(date));
    }

    B publishStart(Instant date);

    default B publishStart(ZonedDateTime date) {
        return publishStart(toDate(date));
    }

    default B publishStart(LocalDateTime date) {
        return publishStart(fromLocalDate(date));
    }

    @Deprecated
    default B publishStop(Date date) {
        return publishStop(DateUtils.toInstant(date));
    }

    B publishStop(Instant date);

    default B publishStop(LocalDateTime date) {
        return publishStop(fromLocalDate(date));
    }

    static Instant fromLocalDate(LocalDateTime date) {
        return DateUtils.toInstant(date, ZONE_ID);

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy