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

org.deephacks.tools4j.config.spi.CacheManager Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/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.deephacks.tools4j.config.spi;

import java.util.List;

import org.deephacks.tools4j.config.model.Bean.BeanId;

/**
 * CacheManager is responsible for maintain cache entries of configurables.
 * The cache can be queried for single or all configurables that exist
 * for a certain schema.
 * 
 * @author Kristoffer Sjogren
 */
public abstract class CacheManager {

    /**
     * Returns the configurable associated with BeanId in this cache.
     * 
     * @param id BeanId that identifies the configurable.
     * @return the configurable, or null if absent.
     */
    public abstract V get(BeanId id);

    /**
     * Returns the configurable associated with schemaName in this cache.
     * 
     * @param schemaName name that identifies as certain type of configurable.
     * @return A list of beans, or null if absent.
     */
    public abstract List get(String schemaName);

    /**
     * Associates configurable with BeanId in this cache. If the cache previously 
     * contained a configurable associated with BeanId, the old configurable is 
     * replaced by configurable. 
     * 
     * @param id BeanId that identifies the configurable
     * @param configurable
     */
    public abstract void put(BeanId id, V configurable);

    /**
     * Associates configurable with BeanId in this cache. If the cache previously 
     * contained a configurable associated with BeanId, the old configurable is 
     * replaced by configurable. 

     * @param schemaName name that identifies as certain type of configurable.
     * @param configurables a list of configurables that exist for this schemaName.
     */
    public abstract void put(String schemaName, List configurables);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy