private Cache doGetCache()

in src/main/java/org/apache/geronimo/jcache/simple/SimpleManager.java [243:260]


    private <K, V> Cache<K, V> doGetCache(final String cacheName, final Class<K> keyType, final Class<V> valueType) {
        final Cache<K, V> cache = (Cache<K, V>) caches.get(cacheName);
        if (keyType == null && valueType == null) {
            return cache;
        }
        if (cache == null) {
            return null;
        }

        final Configuration<K, V> config = cache.getConfiguration(Configuration.class);
        if ((keyType != null && !config.getKeyType().isAssignableFrom(keyType))
                || (valueType != null && !config.getValueType().isAssignableFrom(valueType))) {
            throw new IllegalArgumentException(
                    "this cache is <" + config.getKeyType().getName() + ", " + config.getValueType().getName() + "> "
                            + " and not <" + keyType.getName() + ", " + valueType.getName() + ">");
        }
        return cache;
    }