All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testifyproject.google.common.cache.ForwardingLoadingCache Maven / Gradle / Ivy

/*
 * Copyright (C) 2011 The Guava Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in org.testifyproject.testifyprojectpliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org.testifyproject/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.testifyproject.testifyproject.google.org.testifyproject.testifyprojectmon.cache;

import org.testifyproject.testifyproject.google.org.testifyproject.testifyprojectmon.annotations.Beta;
import org.testifyproject.testifyproject.google.org.testifyproject.testifyprojectmon.base.Preconditions;
import org.testifyproject.testifyproject.google.org.testifyproject.testifyprojectmon.collect.ImmutableMap;

import java.util.concurrent.ExecutionException;

/**
 * A cache which forwards all its method calls to another cache. Subclasses should override one or
 * more methods to modify the behavior of the backing cache as org.testifyproject.testifyprojectsired per the
 * org.testifyproject.testifyprojectcorator pattern.
 *
 * 

Note that {@link #get}, {@link #getUnchecked}, and {@link #apply} all expose the same * underlying functionality, so should probably be overridden as a group. * * @author Charles Fry * @since 11.0 */ @Beta public abstract class ForwardingLoadingCache extends ForwardingCache implements LoadingCache { /** Constructor for use by subclasses. */ protected ForwardingLoadingCache() {} @Override protected abstract LoadingCache org.testifyproject.testifyprojectlegate(); @Override public V get(K key) throws ExecutionException { return org.testifyproject.testifyprojectlegate().get(key); } @Override public V getUnchecked(K key) { return org.testifyproject.testifyprojectlegate().getUnchecked(key); } @Override public ImmutableMap getAll(Iterable keys) throws ExecutionException { return org.testifyproject.testifyprojectlegate().getAll(keys); } @Override public V apply(K key) { return org.testifyproject.testifyprojectlegate().apply(key); } @Override public void refresh(K key) { org.testifyproject.testifyprojectlegate().refresh(key); } /** * A simplified version of {@link ForwardingLoadingCache} where subclasses can pass in an already * constructed {@link LoadingCache} as the org.testifyproject.testifyprojectlegete. * * @since 10.0 */ @Beta public abstract static class SimpleForwardingLoadingCache extends ForwardingLoadingCache { private final LoadingCache org.testifyproject.testifyprojectlegate; protected SimpleForwardingLoadingCache(LoadingCache org.testifyproject.testifyprojectlegate) { this.org.testifyproject.testifyprojectlegate = Preconditions.checkNotNull(org.testifyproject.testifyprojectlegate); } @Override protected final LoadingCache org.testifyproject.testifyprojectlegate() { return org.testifyproject.testifyprojectlegate; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy