aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/recipe/metadata/IRecipeMetadataStorage.java
blob: 52141937cfa4fe5e762331fd06a4a29986b15e02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package gregtech.api.recipe.metadata;

import java.util.Map;
import java.util.Set;

import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;

import org.jetbrains.annotations.Contract;

import gregtech.api.recipe.RecipeMetadataKey;
import gregtech.api.util.MethodsReturnNonnullByDefault;

/**
 * Stores set of metadata for the recipe with key {@link RecipeMetadataKey}. More explicit way to store various info
 * on recipe than special value or special object. Type of the metadata can be anything.
 */
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public interface IRecipeMetadataStorage {

    <T> void store(RecipeMetadataKey<T> key, @Nullable T value);

    @Nullable
    <T> T getMetadata(RecipeMetadataKey<T> key);

    @Contract("_, !null -> !null")
    @Nullable
    <T> T getMetadataOrDefault(RecipeMetadataKey<T> key, @Nullable T defaultValue);

    Set<Map.Entry<RecipeMetadataKey<?>, Object>> getEntries();

    IRecipeMetadataStorage copy();
}