public class Dispatcher
extends java.lang.Object
This class is injected into the bootstrap classpath and is used to share objects between classloaders.
Credits to @felixbarny| Constructor and Description |
|---|
Dispatcher() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
computeIfAbsent(java.lang.String key,
java.util.function.Function<java.lang.String,T> value) |
static <T> T |
get(java.lang.String key)
Gets a shared value by it's key
|
static <T> T |
get(java.lang.String key,
java.lang.Class<T> valueClass)
Gets a shared value by it's key
|
static java.lang.Object |
getObject(java.lang.String key)
Gets a shared value by it's key
|
static java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object> |
getValues()
Returns the underlying
ConcurrentMap |
static void |
put(java.lang.String key,
java.lang.Object value)
Add a value to the shared map
|
public static void put(java.lang.String key,
java.lang.Object value)
key - the key that can be used to retrieve the value via get(String)value - the object to sharepublic static <T> T get(java.lang.String key)
Automatically casts the value to the desired type
T - the type of the valuekey - the keypublic static <T> T computeIfAbsent(java.lang.String key,
java.util.function.Function<java.lang.String,T> value)
public static <T> T get(java.lang.String key,
java.lang.Class<T> valueClass)
Automatically casts the value to the desired type
T - the type of the valuekey - the keyvalueClass - the class of the valuepublic static java.lang.Object getObject(java.lang.String key)
key - the keypublic static java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object> getValues()
ConcurrentMapConcurrentMap