Interface IOverrideInjector<BindableType extends IBindable>
- All Known Implementing Classes:
OverrideInjector
public interface IOverrideInjector<BindableType extends IBindable>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAll core overrides should have this priority.static final intThe priority given to overrides that don't explicitly define a priority.static final intThe lowest priority non-core overrides can have. -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) Seebind(Class, IBindable)for full documentation.voidclear()Removes all bound overrides.<T extends IDhApiOverrideable>
TReturns the bound dependency with the highest priority.<T extends IDhApiOverrideable>
TReturns a dependency of type T with the specified priority if one has been bound.voidunbind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) Removes the given concreteIDhApiOverrideablebound to the given interface.
-
Field Details
-
CORE_PRIORITY
static final int CORE_PRIORITYAll core overrides should have this priority.
Should be lower thanMIN_NON_CORE_OVERRIDE_PRIORITY.- See Also:
-
MIN_NON_CORE_OVERRIDE_PRIORITY
static final int MIN_NON_CORE_OVERRIDE_PRIORITYThe lowest priority non-core overrides can have. Should be higher thanCORE_PRIORITY.- See Also:
-
DEFAULT_NON_CORE_OVERRIDE_PRIORITY
static final int DEFAULT_NON_CORE_OVERRIDE_PRIORITYThe priority given to overrides that don't explicitly define a priority.- See Also:
-
-
Method Details
-
bind
void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException Seebind(Class, IBindable)for full documentation.- Throws:
IllegalArgumentException- if a non-Distant Horizons Override with the priorityCORE_PRIORITYis passed in or an override is passed in with an invalid priority value.IllegalStateException- if another override with the given priority already has been bound.- See Also:
-
get
Returns the bound dependency with the highest priority.
Seeget(Class, boolean)for full documentation.- Throws:
ClassCastException- See Also:
-
get
<T extends IDhApiOverrideable> T get(Class<T> interfaceClass, int priority) throws ClassCastException Returns a dependency of type T with the specified priority if one has been bound.
If there is a dependency, but it was bound with a different priority this will return null.
Seeget(Class, boolean)for more documentation.- Throws:
ClassCastException- See Also:
-
unbind
void unbind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) Removes the given concreteIDhApiOverrideablebound to the given interface. -
clear
void clear()Removes all bound overrides.
-