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

ru.progrm_jarvis.javacommons.object.valuestorage.ValueStorage Maven / Gradle / Ivy

package ru.progrm_jarvis.javacommons.object.valuestorage;

import lombok.NonNull;

/**
 * Storage of values which is made for sharing values which is unavailable via direct standard APIs
 * such as initializing static final fields of generated classes.
 *
 * @param  type of keys used for identifying values
 * @param  type of stored values
 */
public interface ValueStorage {

    /**
     * Stores the given non-null value returning its unique key.
     *
     * @param value non-null value to store
     * @return unique key by which the stored value may be retrieved
     */
    K storeValue(@NonNull V value);

    /**
     * Retrieves (gets and removes) the value stored by the given key.
     *
     * @param key unique key by which the value should be found
     * @return value which was stored by the given key or {@code null} if there was no value stored
     */
    V retrieveValue(K key);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy