Interface DependencyProvider

All Known Implementing Classes:
DependencyProviderBase

public interface DependencyProvider
An interface for a simple dependency provider.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    getDependency(Class<T> clazz)
    Retrieve the dependency of type T.
    default <T> T
    getDependency(Class<T> clazz, String name)
    Retrieve the dependency of type T, with the given name.
  • Method Details

    • getDependency

      <T> T getDependency(Class<T> clazz) throws ClassNotFoundException
      Retrieve the dependency of type T.
      Type Parameters:
      T - The type of the dependency class.
      Parameters:
      clazz - the dependency's class
      Returns:
      the dependency
      Throws:
      ClassNotFoundException - if provider does not have a class registered for the requested class type
    • getDependency

      default <T> T getDependency(Class<T> clazz, String name) throws ClassNotFoundException
      Retrieve the dependency of type T, with the given name.
      Type Parameters:
      T - The type of the dependency class.
      Parameters:
      clazz - the dependency's class
      name - the dependency's name (may be null)
      Returns:
      the dependency
      Throws:
      ClassNotFoundException - if provider does not have a class registered for the requested class type