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

org.opendaylight.infrautils.caches.CheckedCache Maven / Gradle / Ivy

/*
 * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.infrautils.caches;

import com.google.common.collect.ImmutableMap;
import java.util.Arrays;

/**
 * Cache of keys to values, for cache function which may throw a checked exception.
 *
 * 

See {@link Cache} for caches who's cache function never throw checked exceptions (i.e. only unchecked ones). * Cache also has more general documentation which applies to this API as well. * * @param key type of cache (must be immutable) * @param value type of cache (should, for monitoring, typically, be of "similar" size for all keys) * @param exception type cache can throw * * @author Michael Vorburger.ch */ public interface CheckedCache extends BaseCache { /** * Get cache entry. * See {@link Cache#get(Object)} for more documentation. * * @throws E if the cache's function throw that exception for this key */ V get(K key) throws E; ImmutableMap get(Iterable keys) throws E; @SuppressWarnings("unchecked") default ImmutableMap get(K... keys) throws E { return get(Arrays.asList(keys)); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy