Class LoaderEnvironmentRegistry
java.lang.Object
dev.jaxydog.lodestone.impl.LoaderEnvironmentRegistry
Retains information about all registered loader environments.
- Since:
- 1.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AtomicBooleanTracks whether Lodestone has finished initializing bundled environments and should forbid new bundled interfaces from being loaded. -
Method Summary
Modifier and TypeMethodDescription<T extends Loaded>
voidaddEntrypoint(Class<? extends T> type, T entrypoint) Adds an entrypoint to theLoaderEnvironmentRegistryinstance associated with the givenLoadedinterface.static LoaderEnvironmentRegistrycreate()Creates a new, emptyLoaderEnvironmentRegistryinstance.Returns a set containing all registered interface instances.<T extends Loaded>
booleanReturns whether aLoaderEnvironmentfor the givenLoadedinterface was previously registered.<T extends Loaded>
voidloadEntrypoints(Class<? extends T> type, String modId) Loads theLoaderEnvironmentinstance associated with the givenLoadedinterface.<T extends Loaded>
voidregister(LoaderEnvironment<T> environment) Registers the givenLoaderEnvironment.
-
Field Details
-
FORBID_BUNDLED
Tracks whether Lodestone has finished initializing bundled environments and should forbid new bundled interfaces from being loaded.- Since:
- 1.6.0
-
-
Method Details
-
create
Creates a new, emptyLoaderEnvironmentRegistryinstance.- Returns:
- A new
LoaderEnvironmentRegistryinstance. - Since:
- 1.0.0
-
register
public <T extends Loaded> void register(LoaderEnvironment<T> environment) throws IllegalArgumentException, NullPointerException Registers the givenLoaderEnvironment.- Type Parameters:
T- The type of the associatedLoadedinterface.- Parameters:
environment- The environment instance.- Throws:
IllegalArgumentException- If the given environment's associatedLoadedinterface has already been registered, or if the given environment's associatedLoadedtype is not an interface. This may also be thrown when attempting to register a new "bundled" environment.NullPointerException- If the given environment is null.- Since:
- 1.0.0
-
has
Returns whether aLoaderEnvironmentfor the givenLoadedinterface was previously registered.- Type Parameters:
T- The type of the associatedLoadedinterface.- Parameters:
type- The expectedLoadedinterface.- Returns:
- Whether a
LoaderEnvironmentwas previously registered. - Since:
- 1.0.0
-
getInterfaces
-
addEntrypoint
public <T extends Loaded> void addEntrypoint(Class<? extends T> type, T entrypoint) throws IllegalArgumentException, NullPointerException Adds an entrypoint to theLoaderEnvironmentRegistryinstance associated with the givenLoadedinterface.- Type Parameters:
T- The type of the associatedLoadedinterface.- Parameters:
type- The expectedLoadedinterface.entrypoint- The entrypoint.- Throws:
IllegalArgumentException- If the givenLoadedinterface does not have a registeredLoaderEnvironment.NullPointerException- If the given entrypoint is null.- Since:
- 1.0.0
-
loadEntrypoints
public <T extends Loaded> void loadEntrypoints(Class<? extends T> type, String modId) throws IllegalArgumentException Loads theLoaderEnvironmentinstance associated with the givenLoadedinterface.If the defined
LoaderEnvironment.loadValue(Loaded)method throws, the thrown error will be bubbled up.- Type Parameters:
T- The type of the associatedLoadedinterface.- Parameters:
type- The expectedLoadedinterface.modId- The loaded mod's identifier.- Throws:
IllegalArgumentException- If the givenLoadedinterface does not have a registeredLoaderEnvironment.- Since:
- 1.0.0
-