Class WireProvider<F>
java.lang.Object
dev.wyck.factory.WireProvider<F>
- Type Parameters:
F- the type of the factory
- Direct Known Subclasses:
ConstructWireProvider, OptionalWireProvider
@NullMarked
@AsOf("2.2.0")
@Internal
public sealed class WireProvider<F>
extends Object
permits OptionalWireProvider<F>, ConstructWireProvider<F>
A provider for lazily loading factory instances based on the active Minecraft version.
- Since:
- 2.0.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <F> ConstructWireProvider<F> Creates a WireProvider that uses the given template to construct the factory.static <F> WireProvider<F> Creates a new WireProvider instance.static <F> OptionalWireProvider<F> empty()Creates a WireProvider that does not reflectively instantiate anything.get()Gets the factory instance.getNew()Forces a new factory instance, bypassing the cached singleton.booleanChecks if the factory has been registered.Resolves the backing factory class fromclassNameTemplate, applying whichever version operator the template uses.voidsetProvider(Class<?> caller, F factory)
-
Field Details
-
factory
-
-
Constructor Details
-
WireProvider
-
-
Method Details
-
create
Creates a new WireProvider instance.- Type Parameters:
F- the type of the factory- Parameters:
template- the class name template to use for loading the factory- Returns:
- a new WireProvider instance
- Since:
- 2.0.0
-
empty
Creates a WireProvider that does not reflectively instantiate anything.- Type Parameters:
F- the type of the factory- Returns:
- a WireProvider that is empty
- Since:
- 2.4.1
-
construct
Creates a WireProvider that uses the given template to construct the factory.- Type Parameters:
F- the type of the factory- Parameters:
template- the class name template to use for loading the factory- Returns:
- a WireProvider that constructs the factory using the given template
- Since:
- 2.4.1
-
isRegistered
Checks if the factory has been registered.- Returns:
- true if the factory has been registered, false otherwise
-
get
-
getNew
-
resolveClass
-
setProvider
-