Coverage Summary for Class: ForwardingMultimap (com.google.common.collect)

Class Class, % Method, % Line, %
ForwardingMultimap 100% (1/1) 9.5% (2/21) 9.1% (2/22)


1 /* 2  * Copyright (C) 2007 The Guava Authors 3  * 4  * Licensed under the Apache License, Version 2.0 (the "License"); 5  * you may not use this file except in compliance with the License. 6  * You may obtain a copy of the License at 7  * 8  * http://www.apache.org/licenses/LICENSE-2.0 9  * 10  * Unless required by applicable law or agreed to in writing, software 11  * distributed under the License is distributed on an "AS IS" BASIS, 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13  * See the License for the specific language governing permissions and 14  * limitations under the License. 15  */ 16  17 package com.google.common.collect; 18  19 import com.google.common.annotations.GwtCompatible; 20 import com.google.errorprone.annotations.CanIgnoreReturnValue; 21 import java.util.Collection; 22 import java.util.Map; 23 import java.util.Map.Entry; 24 import java.util.Set; 25 import org.checkerframework.checker.nullness.qual.Nullable; 26  27 /** 28  * A multimap which forwards all its method calls to another multimap. Subclasses should override 29  * one or more methods to modify the behavior of the backing multimap as desired per the <a 30  * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. 31  * 32  * <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code 33  * default} methods. Instead, it inherits their default implementations. When those implementations 34  * invoke methods, they invoke methods on the {@code ForwardingMultimap}. 35  * 36  * @author Robert Konigsberg 37  * @since 2.0 38  */ 39 @GwtCompatible 40 public abstract class ForwardingMultimap<K, V> extends ForwardingObject implements Multimap<K, V> { 41  42  /** Constructor for use by subclasses. */ 43  protected ForwardingMultimap() {} 44  45  @Override 46  protected abstract Multimap<K, V> delegate(); 47  48  @Override 49  public Map<K, Collection<V>> asMap() { 50  return delegate().asMap(); 51  } 52  53  @Override 54  public void clear() { 55  delegate().clear(); 56  } 57  58  @Override 59  public boolean containsEntry(@Nullable Object key, @Nullable Object value) { 60  return delegate().containsEntry(key, value); 61  } 62  63  @Override 64  public boolean containsKey(@Nullable Object key) { 65  return delegate().containsKey(key); 66  } 67  68  @Override 69  public boolean containsValue(@Nullable Object value) { 70  return delegate().containsValue(value); 71  } 72  73  @Override 74  public Collection<Entry<K, V>> entries() { 75  return delegate().entries(); 76  } 77  78  @Override 79  public Collection<V> get(@Nullable K key) { 80  return delegate().get(key); 81  } 82  83  @Override 84  public boolean isEmpty() { 85  return delegate().isEmpty(); 86  } 87  88  @Override 89  public Multiset<K> keys() { 90  return delegate().keys(); 91  } 92  93  @Override 94  public Set<K> keySet() { 95  return delegate().keySet(); 96  } 97  98  @CanIgnoreReturnValue 99  @Override 100  public boolean put(K key, V value) { 101  return delegate().put(key, value); 102  } 103  104  @CanIgnoreReturnValue 105  @Override 106  public boolean putAll(K key, Iterable<? extends V> values) { 107  return delegate().putAll(key, values); 108  } 109  110  @CanIgnoreReturnValue 111  @Override 112  public boolean putAll(Multimap<? extends K, ? extends V> multimap) { 113  return delegate().putAll(multimap); 114  } 115  116  @CanIgnoreReturnValue 117  @Override 118  public boolean remove(@Nullable Object key, @Nullable Object value) { 119  return delegate().remove(key, value); 120  } 121  122  @CanIgnoreReturnValue 123  @Override 124  public Collection<V> removeAll(@Nullable Object key) { 125  return delegate().removeAll(key); 126  } 127  128  @CanIgnoreReturnValue 129  @Override 130  public Collection<V> replaceValues(K key, Iterable<? extends V> values) { 131  return delegate().replaceValues(key, values); 132  } 133  134  @Override 135  public int size() { 136  return delegate().size(); 137  } 138  139  @Override 140  public Collection<V> values() { 141  return delegate().values(); 142  } 143  144  @Override 145  public boolean equals(@Nullable Object object) { 146  return object == this || delegate().equals(object); 147  } 148  149  @Override 150  public int hashCode() { 151  return delegate().hashCode(); 152  } 153 }