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 Type
    Method
    Description
    <T> T
    getInstance(Class<T> type)
    Returns an instance of the specified type.
    <T> T
    getVariable(Class<T> type, String name)
    Returns the value of the specified variable.
    boolean
    Returns whether the dependency injector is initialized.
  • Method Details

    • getInstance

      <T> T getInstance(Class<T> type)
      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

      <T> T getVariable(Class<T> type, String name)
      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 return
      name - 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:
      true if the dependency injector is initialized, false otherwise