001/*
002 * Copyright (C) 2010 The Guava Authors
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.google.common.collect;
018
019import com.google.common.annotations.GwtCompatible;
020import java.util.Comparator;
021import java.util.SortedSet;
022import javax.annotation.CheckForNull;
023import org.checkerframework.checker.nullness.qual.Nullable;
024
025/**
026 * A sorted set multimap which forwards all its method calls to another sorted set multimap.
027 * Subclasses should override one or more methods to modify the behavior of the backing multimap as
028 * desired per the <a href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
029 *
030 * <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
031 * default} methods. Instead, it inherits their default implementations. When those implementations
032 * invoke methods, they invoke methods on the {@code ForwardingSortedSetMultimap}.
033 *
034 * @author Kurt Alfred Kluever
035 * @since 3.0
036 */
037@GwtCompatible
038@ElementTypesAreNonnullByDefault
039public abstract class ForwardingSortedSetMultimap<
040        K extends @Nullable Object, V extends @Nullable Object>
041    extends ForwardingSetMultimap<K, V> implements SortedSetMultimap<K, V> {
042
043  /** Constructor for use by subclasses. */
044  protected ForwardingSortedSetMultimap() {}
045
046  @Override
047  protected abstract SortedSetMultimap<K, V> delegate();
048
049  @Override
050  public SortedSet<V> get(@ParametricNullness K key) {
051    return delegate().get(key);
052  }
053
054  @Override
055  public SortedSet<V> removeAll(@CheckForNull Object key) {
056    return delegate().removeAll(key);
057  }
058
059  @Override
060  public SortedSet<V> replaceValues(@ParametricNullness K key, Iterable<? extends V> values) {
061    return delegate().replaceValues(key, values);
062  }
063
064  @Override
065  @CheckForNull
066  public Comparator<? super V> valueComparator() {
067    return delegate().valueComparator();
068  }
069}