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

nl.vpro.domain.media.support.OwnableList 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.media.support;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.checkerframework.checker.nullness.qual.NonNull;

/**
 * An 'ownable list' is an iterable of {@link OwnableListItem}, combined with an 'owner' value.
 * 

* It does not actually completely implement {@link List}. {@link #getValues()} does. * * @author Michiel Meeuwissen * @since 5.11 * @param The self type, used in {@link Comparable}, and in the item type * @param The item type */ public interface OwnableList, I extends OwnableListItem> //extends Collection, // Implementing Collection confuses Jackson, it will ignore all annotation and serialize as an array. extends Iterable, Comparable, Ownable { @NonNull List getValues(); // Default implementing Collection //@Override default int size() { return getValues().size(); } //@Override default boolean isEmpty() { return getValues().isEmpty(); } //@Override default boolean contains(Object element) { return getValues().contains(element); } //@Override @NonNull default Iterator iterator() { return getValues().iterator(); } //@Override @NonNull default Object[] toArray() { return getValues().toArray(); } //@Override @NonNull default T[] toArray(@NonNull T[] a) { return getValues().toArray(a); } //@Override default boolean add(I value) { return getValues().add(value); } //@Override default boolean remove(Object o) { return getValues().remove(o); } //@Override default boolean containsAll(@NonNull Collection c) { return getValues().containsAll(c); } //@Override default boolean addAll(@NonNull Collection c) { return getValues().addAll(c); } //@Override default boolean removeAll(@NonNull Collection c) { return getValues().removeAll(c); } //@Override default boolean retainAll(@NonNull Collection c) { return getValues().retainAll(c); } //@Override default void clear() { getValues().clear(); } }