1/* 2 * Copyright (C) 2010 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 17package com.google.common.collect; 18 19import com.google.common.annotations.Beta; 20import com.google.common.annotations.GwtCompatible; 21import com.google.common.base.Function; 22 23import java.util.concurrent.ConcurrentMap; 24import java.util.concurrent.TimeUnit; 25 26/** 27 * A class exactly like {@link MapMaker}, except restricted in the types of maps it can build. 28 * For the most part, you should probably just ignore the existence of this class. 29 * 30 * @paramthe base type for all key types of maps built by this map maker 31 * @param the base type for all value types of maps built by this map maker 32 * @author Kevin Bourrillion 33 * @since 7.0 34 */ 35@Beta 36@GwtCompatible(emulated = true) 37public abstract class GenericMapMaker<K0, V0> { 38 39 // Set by MapMaker, but sits in this class to preserve the type relationship 40 41 // No subclasses but our own 42 GenericMapMaker() {} 43 44 /** 45 * See {@link MapMaker#initialCapacity}. 46 */ 47 public abstract GenericMapMaker<K0, V0> initialCapacity(int initialCapacity); 48 49 /** 50 * See {@link MapMaker#maximumSize}. 51 */ 52 abstract GenericMapMaker<K0, V0> maximumSize(int maximumSize); 53 54 /** 55 * See {@link MapMaker#strongKeys}. 56 */ 57 abstract GenericMapMaker<K0, V0> strongKeys(); 58 59 /** 60 * See {@link MapMaker#concurrencyLevel}. 61 */ 62 public abstract GenericMapMaker<K0, V0> concurrencyLevel(int concurrencyLevel); 63 64 /** 65 * See {@link MapMaker#strongValues}. 66 */ 67 abstract GenericMapMaker<K0, V0> strongValues(); 68 69 /** 70 * See {@link MapMaker#expiration}. 71 */ 72 @Deprecated 73 public 74 abstract GenericMapMaker<K0, V0> expiration(long duration, TimeUnit unit); 75 76 /** 77 * See {@link MapMaker#expireAfterWrite}. 78 */ 79 abstract GenericMapMaker<K0, V0> expireAfterWrite(long duration, TimeUnit unit); 80 81 /* 82 * Note that MapMaker's removalListener() is not here, because once you're interacting with a 83 * GenericMapMaker you've already called that, and shouldn't be calling it again. 84 */ 85 86 /** 87 * See {@link MapMaker#makeMap}. 88 */ 89 public abstract <K extends K0, V extends V0> ConcurrentMap<K, V> makeMap(); 90 91 /** 92 * See {@link MapMaker#makeComputingMap}. 93 */ 94 @Deprecated 95 public abstract <K extends K0, V extends V0> ConcurrentMap<K, V> makeComputingMap( 96 Function<? super K, ? extends V> computingFunction); 97} 98