blob: 5bd37c591766d2edfbfd72413012eb0c2306d9bf [file] [log] [blame]
Aaron Kruglikov61582a02016-09-06 13:18:58 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
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
17package org.onosproject.store.primitives.impl;
18
Jordan Halterman9bdc24f2017-04-19 23:45:12 -070019import java.util.Collection;
20import java.util.Map;
21import java.util.Set;
22import java.util.concurrent.CompletableFuture;
23
Aaron Kruglikov61582a02016-09-06 13:18:58 -070024import com.google.common.collect.Multiset;
25import org.onosproject.store.service.AsyncConsistentMultimap;
26import org.onosproject.store.service.Versioned;
27
Aaron Kruglikov61582a02016-09-06 13:18:58 -070028/**
29 * {@code AsyncConsistentMultimap} that merely delegates control to
30 * another AsyncConsistentMultimap.
31 *
32 * @param <K> key type
33 * @param <V> value type
34 */
35public class DelegatingAsyncConsistentMultimap<K, V>
Jordan Halterman9bdc24f2017-04-19 23:45:12 -070036 extends DelegatingDistributedPrimitive implements AsyncConsistentMultimap<K, V> {
Aaron Kruglikov61582a02016-09-06 13:18:58 -070037
38 private final AsyncConsistentMultimap<K, V> delegateMap;
39
40 public DelegatingAsyncConsistentMultimap(
41 AsyncConsistentMultimap<K, V> delegateMap) {
Jordan Halterman9bdc24f2017-04-19 23:45:12 -070042 super(delegateMap);
43 this.delegateMap = delegateMap;
Aaron Kruglikov61582a02016-09-06 13:18:58 -070044 }
45
46 @Override
47 public CompletableFuture<Integer> size() {
48 return delegateMap.size();
49 }
50
51 @Override
52 public CompletableFuture<Boolean> isEmpty() {
53 return delegateMap.isEmpty();
54 }
55
56 @Override
57 public CompletableFuture<Boolean> containsKey(K key) {
58 return delegateMap.containsKey(key);
59 }
60
61 @Override
62 public CompletableFuture<Boolean> containsValue(V value) {
63 return delegateMap.containsValue(value);
64 }
65
66 @Override
67 public CompletableFuture<Boolean> containsEntry(K key, V value) {
68 return delegateMap.containsEntry(key, value);
69 }
70
71 @Override
72 public CompletableFuture<Boolean> put(K key, V value) {
73 return delegateMap.put(key, value);
74 }
75
76 @Override
77 public CompletableFuture<Boolean> remove(K key, V value) {
78 return delegateMap.remove(key, value);
79 }
80
81 @Override
82 public CompletableFuture<Boolean> removeAll(
83 K key, Collection<? extends V> values) {
84 return delegateMap.removeAll(key, values);
85 }
86
87 @Override
88 public CompletableFuture<Versioned<Collection<? extends V>>>
89 removeAll(K key) {
90 return delegateMap.removeAll(key);
91 }
92
93 @Override
94 public CompletableFuture<Boolean> putAll(
95 K key, Collection<? extends V> values) {
96 return delegateMap.putAll(key, values);
97 }
98
99 @Override
100 public CompletableFuture<Versioned<Collection<? extends V>>>
101 replaceValues(K key, Collection<V> values) {
102 return delegateMap.replaceValues(key, values);
103 }
104
105 @Override
106 public CompletableFuture<Void> clear() {
107 return delegateMap.clear();
108 }
109
110 @Override
111 public CompletableFuture<Versioned<Collection<? extends V>>> get(K key) {
112 return delegateMap.get(key);
113 }
114
115 @Override
116 public CompletableFuture<Set<K>> keySet() {
117 return delegateMap.keySet();
118 }
119
120 @Override
121 public CompletableFuture<Multiset<K>> keys() {
122 return delegateMap.keys();
123 }
124
125 @Override
126 public CompletableFuture<Multiset<V>> values() {
127 return delegateMap.values();
128 }
129
130 @Override
131 public CompletableFuture<Collection<Map.Entry<K, V>>> entries() {
132 return delegateMap.entries();
133 }
134
135 @Override
136 public CompletableFuture<Map<K, Collection<V>>> asMap() {
137 return delegateMap.asMap();
138 }
Aaron Kruglikov61582a02016-09-06 13:18:58 -0700139}