Class DefaultCustomInjectorRegistry
java.lang.Object
tech.guilhermekaua.spigotboot.core.context.dependency.injector.DefaultCustomInjectorRegistry
- All Implemented Interfaces:
CustomInjectorRegistry
Default implementation of
CustomInjectorRegistry.
This implementation is thread-safe and uses a CopyOnWriteArrayList for
storage with a volatile sorted view for efficient reads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all registered injectors.booleancustomInjectorSupported(@NotNull InjectionPoint injectionPoint) Checks if any registered custom injector supports the given injection point.@NotNull List<CustomInjector>Returns an unmodifiable ordered view of all registered injectors.booleanisEmpty()Checks if the registry is empty.voidregister(@NotNull CustomInjector injector) Registers a custom injector.intsize()Returns the number of registered injectors.booleanunregister(@NotNull CustomInjector injector) Unregisters a custom injector.
-
Constructor Details
-
DefaultCustomInjectorRegistry
public DefaultCustomInjectorRegistry()
-
-
Method Details
-
register
Description copied from interface:CustomInjectorRegistryRegisters a custom injector.The injector will be added to the registry and the sorted view will be updated. Injectors are ordered by their
CustomInjector.getOrder()value.- Specified by:
registerin interfaceCustomInjectorRegistry- Parameters:
injector- the custom injector to register, not null
-
unregister
Description copied from interface:CustomInjectorRegistryUnregisters a custom injector.- Specified by:
unregisterin interfaceCustomInjectorRegistry- Parameters:
injector- the custom injector to remove, not null- Returns:
- true if the injector was found and removed, false otherwise
-
getInjectors
Description copied from interface:CustomInjectorRegistryReturns an unmodifiable ordered view of all registered injectors.The list is sorted by
CustomInjector.getOrder(), with lower values first.- Specified by:
getInjectorsin interfaceCustomInjectorRegistry- Returns:
- an unmodifiable list of injectors in order of priority
-
customInjectorSupported
Description copied from interface:CustomInjectorRegistryChecks if any registered custom injector supports the given injection point.- Specified by:
customInjectorSupportedin interfaceCustomInjectorRegistry- Parameters:
injectionPoint- the injection point to check- Returns:
- true if any custom injector supports this injection point
-
clear
public void clear()Description copied from interface:CustomInjectorRegistryClears all registered injectors.- Specified by:
clearin interfaceCustomInjectorRegistry
-
size
public int size()Description copied from interface:CustomInjectorRegistryReturns the number of registered injectors.- Specified by:
sizein interfaceCustomInjectorRegistry- Returns:
- the count of registered injectors
-
isEmpty
public boolean isEmpty()Description copied from interface:CustomInjectorRegistryChecks if the registry is empty.- Specified by:
isEmptyin interfaceCustomInjectorRegistry- Returns:
- true if no injectors are registered
-