Class OptionalWireProvider<F>
- Type Parameters:
F- the type of the factory
A WireProvider that returns null if the factory does not exist.
- Since:
- 2.1.0
-
Field Summary
Fields inherited from class WireProvider
factory -
Method Summary
Modifier and TypeMethodDescriptionstatic <F> @NonNull OptionalWireProvider<@NonNull F> Creates a new NullableWireProvider that reflectively instantiates the named class if no provider has been explicitly set.static <F> @NonNull OptionalWireProvider<@NonNull F> empty()Creates a new NullableWireProvider that does not reflectively instantiate anything.get()Gets the factory instance.optional()Methods inherited from class WireProvider
construct, getNew, isRegistered, resolveClass, setProvider
-
Method Details
-
create
-
empty
Creates a new NullableWireProvider that does not reflectively instantiate anything. The provider is null untilWireProvider.setProvider(Class, F)is called explicitly. Useful when the target class has side effects in its constructor that should only run after the host plugin has explicitly wired itself up. -
get
-
optional
-