Interface DependencyInjector
- All Known Implementing Classes:
GuiceDependencyInjector
public interface DependencyInjector
This interface defines the contract for a dependency injector.
It provides methods to retrieve instances and variables of a specific type.
- Author:
- codeboyzhou
-
Method Summary
Modifier and TypeMethodDescription<T> TgetInstance(Class<T> type) Returns an instance of the specified type.<T> TgetVariable(Class<T> type, String name) Returns the value of the specified variable.booleanReturns whether the dependency injector is initialized.
-
Method Details
-
getInstance
Returns an instance of the specified type.- Type Parameters:
T- the type of the instance to return- Parameters:
type- the class of the instance to return- Returns:
- an instance of the specified type
-
getVariable
Returns the value of the specified variable.- Type Parameters:
T- the type of the variable to return- Parameters:
type- the class of the variable to returnname- the name of the variable to return- Returns:
- the value of the specified variable
-
isInitialized
boolean isInitialized()Returns whether the dependency injector is initialized.- Returns:
trueif the dependency injector is initialized,falseotherwise
-