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

com.ibm.icu.impl.CacheBase Maven / Gradle / Ivy

Go to download

Vaadin is a web application framework for Rich Internet Applications (RIA). Vaadin enables easy development and maintenance of fast and secure rich web applications with a stunning look and feel and a wide browser support. It features a server-side architecture with the majority of the logic running on the server. Ajax technology is used at the browser-side to ensure a rich and interactive user experience.

There is a newer version: 1.2.0
Show newest version
/*
*******************************************************************************
*   Copyright (C) 2010, International Business Machines
*   Corporation and others.  All Rights Reserved.
*******************************************************************************
*/
package com.ibm.icu.impl;

/**
 * Base class for cache implementations.
 * To use, instantiate a subclass of a concrete implementation class, where the subclass
 * implements the createInstance() method, and call get() with the key and the data.
 * The get() call will use the data only if it needs to call createInstance(),
 * otherwise the data is ignored.
 *
 * @param  Cache lookup key type
 * @param  Cache instance value type
 * @param  Data type for creating a new instance value
 *
 * @author Markus Scherer, Mark Davis
 */
public abstract class CacheBase {
    /**
     * Retrieves an instance from the cache. Calls createInstance(key, data) if the cache
     * does not already contain an instance with this key.
     * Ignores data if the cache already contains an instance with this key.
     * @param key Cache lookup key for the requested instance
     * @param data Data for createInstance() if the instance is not already cached
     * @return The requested instance
     */
    public abstract V getInstance(K key, D data);
    /**
     * Creates an instance for the key and data. Must be overridden.
     * @param key Cache lookup key for the requested instance
     * @param data Data for the instance creation
     * @return The requested instance
     */
    protected abstract V createInstance(K key, D data);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy