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

org.echocat.jomon.cache.management.LruCacheCreator Maven / Gradle / Ivy

The newest version!
/*****************************************************************************************
 * *** BEGIN LICENSE BLOCK *****
 *
 * Version: MPL 2.0
 *
 * echocat Jomon, Copyright (c) 2012-2013 echocat
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * *** END LICENSE BLOCK *****
 ****************************************************************************************/

package org.echocat.jomon.cache.management;

import org.echocat.jomon.cache.Cache;
import org.echocat.jomon.cache.LimitedCache;
import org.echocat.jomon.cache.LruCache;

import javax.annotation.Nonnull;

public class LruCacheCreator extends DefaultCacheCreatorSupport {

    @Override
    public boolean canHandleType(@Nonnull Class> type) throws Exception {
        return LruCache.class.isAssignableFrom(type);
    }

    @Nonnull
    @Override
    protected  LimitedCache newInstance(@Nonnull CacheDefinition by) throws Exception {
        return new LruCache<>(by.getKeyType(), by.getValueType());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy