1 /* 2 * Copyright (C) 2007 Google Inc. 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 21 import java.util.Collection; 22 import java.util.Map; 23 import java.util.Map.Entry; 24 import java.util.Set; 25 26 import javax.annotation.Nullable; 27 28 /** 29 * A multimap which forwards all its method calls to another multimap. 30 * Subclasses should override one or more methods to modify the behavior of 31 * the backing multimap as desired per the <a 32 * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. 33 * 34 * @see ForwardingObject 35 * @author Robert Konigsberg 36 * @since 2010.01.04 <b>stable</b> (imported from Google Collections Library) 37 */ 38 @GwtCompatible 39 public abstract class ForwardingMultimap<K, V> extends ForwardingObject 40 implements Multimap<K, V> { 41 delegate()42 @Override protected abstract Multimap<K, V> delegate(); 43 asMap()44 public Map<K, Collection<V>> asMap() { 45 return delegate().asMap(); 46 } 47 clear()48 public void clear() { 49 delegate().clear(); 50 } 51 containsEntry(@ullable Object key, @Nullable Object value)52 public boolean containsEntry(@Nullable Object key, @Nullable Object value) { 53 return delegate().containsEntry(key, value); 54 } 55 containsKey(@ullable Object key)56 public boolean containsKey(@Nullable Object key) { 57 return delegate().containsKey(key); 58 } 59 containsValue(@ullable Object value)60 public boolean containsValue(@Nullable Object value) { 61 return delegate().containsValue(value); 62 } 63 entries()64 public Collection<Entry<K, V>> entries() { 65 return delegate().entries(); 66 } 67 get(@ullable K key)68 public Collection<V> get(@Nullable K key) { 69 return delegate().get(key); 70 } 71 isEmpty()72 public boolean isEmpty() { 73 return delegate().isEmpty(); 74 } 75 keys()76 public Multiset<K> keys() { 77 return delegate().keys(); 78 } 79 keySet()80 public Set<K> keySet() { 81 return delegate().keySet(); 82 } 83 put(K key, V value)84 public boolean put(K key, V value) { 85 return delegate().put(key, value); 86 } 87 putAll(K key, Iterable<? extends V> values)88 public boolean putAll(K key, Iterable<? extends V> values) { 89 return delegate().putAll(key, values); 90 } 91 putAll(Multimap<? extends K, ? extends V> multimap)92 public boolean putAll(Multimap<? extends K, ? extends V> multimap) { 93 return delegate().putAll(multimap); 94 } 95 remove(@ullable Object key, @Nullable Object value)96 public boolean remove(@Nullable Object key, @Nullable Object value) { 97 return delegate().remove(key, value); 98 } 99 removeAll(@ullable Object key)100 public Collection<V> removeAll(@Nullable Object key) { 101 return delegate().removeAll(key); 102 } 103 replaceValues(K key, Iterable<? extends V> values)104 public Collection<V> replaceValues(K key, Iterable<? extends V> values) { 105 return delegate().replaceValues(key, values); 106 } 107 size()108 public int size() { 109 return delegate().size(); 110 } 111 values()112 public Collection<V> values() { 113 return delegate().values(); 114 } 115 equals(@ullable Object object)116 @Override public boolean equals(@Nullable Object object) { 117 return object == this || delegate().equals(object); 118 } 119 hashCode()120 @Override public int hashCode() { 121 return delegate().hashCode(); 122 } 123 } 124