public interface ScriptExportRegistry
All scripts are stateless, so data which needs to persist between reloads must be saved to the export registry.
The same export registry is shared between scripts using the same SystemScriptBindings.
| Modifier and Type | Method and Description |
|---|---|
static ScriptExportRegistry |
create() |
default <T> T |
get(String key)
Gets an export handle, if present
|
default <T> T |
get(String key,
Supplier<T> other)
Gets or initializes a new export, and sets it to the given value if empty
|
default <T> T |
get(String key,
T other)
Gets or initializes a new export, and sets it to the given value if empty
|
Collection<ScriptExport<?>> |
getExports()
Gets all exports in this registry
|
<T> ScriptExport<T> |
handle(String key)
Produces and returns a script export handle
|
default <T> ScriptExport<T> |
handle(String key,
Supplier<T> defaultValue)
Produces and returns a script export handle
|
default <T> ScriptExport<T> |
handle(String key,
T defaultValue)
Produces and returns a script export handle
|
boolean |
has(String key)
Gets if this export registry has a certain export
|
void |
remove(String key)
Removes an export from this registry.
|
default <T> ScriptExport<T> |
set(String key,
T value)
Gets or initializes a new export, and sets it to the given value
|
@Nonnull static ScriptExportRegistry create()
@Nonnull <T> ScriptExport<T> handle(@Nonnull String key)
T - the export typekey - the key of the handle@Nonnull default <T> ScriptExport<T> handle(@Nonnull String key, T defaultValue)
T - the export typekey - the key of the handledefaultValue - the value to populate the handle with if empty@Nonnull default <T> ScriptExport<T> handle(@Nonnull String key, Supplier<T> defaultValue)
T - the export typekey - the key of the handledefaultValue - the value to populate the handle with if empty@Nullable default <T> T get(@Nonnull String key)
T - the export typekey - the key of the handledefault <T> T get(@Nonnull String key, T other)
T - the export typekey - the handle keyother - the value to populate the handle with if emptydefault <T> T get(@Nonnull String key, @Nonnull Supplier<T> other)
T - the export typekey - the handle keyother - the value to populate the handle with if empty@Nonnull default <T> ScriptExport<T> set(@Nonnull String key, T value)
T - the export typekey - the handle keyvalue - the value to setboolean has(@Nonnull String key)
key - the get of the exportvoid remove(@Nonnull String key)
key - the export key@Nonnull Collection<ScriptExport<?>> getExports()
Copyright © 2017. All rights reserved.