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

nl.vpro.domain.MutableEmbargo 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.1
Show newest version
package nl.vpro.domain;

import java.time.Instant;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import com.google.common.collect.Range;

/**
 * As {@link Embargo} but, also includes setters
 *
 * @author Michiel Meeuwissen
 * @since 5.1
 */
public interface MutableEmbargo> extends Embargo {

    @NonNull
    T setPublishStartInstant(@Nullable Instant publishStart);

    @NonNull
    T setPublishStopInstant(@Nullable Instant publishStop);

    @SuppressWarnings("unchecked")
    default T set(Range range) {
        if (range.hasLowerBound()) {
            setPublishStartInstant(range.lowerEndpoint());
        } else {
            setPublishStartInstant(null);
        }
        if (range.hasUpperBound()) {
            setPublishStopInstant(range.upperEndpoint());
        } else {
            setPublishStopInstant(null);
        }
        return (T) this;
    }



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy