public enum CapabilityManager extends java.lang.Enum<CapabilityManager>
Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Field and Description |
---|---|
private java.util.IdentityHashMap<java.lang.String,java.util.List<java.util.function.Function<Capability<?>,java.lang.Object>>> |
callbacks |
private java.util.IdentityHashMap<java.lang.String,Capability<?>> |
providers |
Modifier and Type | Method and Description |
---|---|
void |
injectCapabilities(ASMDataTable data) |
<T> void |
register(java.lang.Class<T> type,
Capability.IStorage<T> storage,
java.util.concurrent.Callable<? extends T> factory)
Registers a capability to be consumed by others.
|
<T> void |
register(java.lang.Class<T> type,
Capability.IStorage<T> storage,
java.lang.Class<? extends T> implementation)
Deprecated.
Use the overload that takes a factory instead of a class.
You can easily do this by passing a constructor reference
(MyImpl::new instead of MyImpl.class). TODO remove in 1.13.
|
static CapabilityManager |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static CapabilityManager[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CapabilityManager INSTANCE
private java.util.IdentityHashMap<java.lang.String,Capability<?>> providers
private java.util.IdentityHashMap<java.lang.String,java.util.List<java.util.function.Function<Capability<?>,java.lang.Object>>> callbacks
public static CapabilityManager[] values()
for (CapabilityManager c : CapabilityManager.values()) System.out.println(c);
public static CapabilityManager valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null@Deprecated public <T> void register(java.lang.Class<T> type, Capability.IStorage<T> storage, java.lang.Class<? extends T> implementation)
type
- The Interface to be registeredstorage
- A default implementation of the storage handler.implementation
- A default implementation of the interface.public <T> void register(java.lang.Class<T> type, Capability.IStorage<T> storage, java.util.concurrent.Callable<? extends T> factory)
type
- The Interface to be registeredstorage
- A default implementation of the storage handler.factory
- A Factory that will produce new instances of the default implementation.public void injectCapabilities(ASMDataTable data)