Interface Container

    • Method Detail

      • getInstance

        <T> T getInstance​(com.google.inject.Key<T> key)
        Returns the appropriate instance for the given injection key. When feasible, avoid using this method in favor of having Guice inject your dependencies ahead of time.
        Type Parameters:
        T - The class of the instance to return.
        Parameters:
        key - The key of the instance to return.
        Returns:
        The appropriate instance of the given class.
        Throws:
        com.google.inject.ConfigurationException - If this injector cannot find or create the provider.
        com.google.inject.ProvisionException - If there was a runtime failure while providing an instance.
      • getInstance

        <T> T getInstance​(java.lang.Class<T> type)
        Returns the appropriate instance for the given injection type. When feasible, avoid using this method in favor of having Guice inject your dependencies ahead of time.
        Type Parameters:
        T - The class of the instance to return.
        Parameters:
        type - The class object of the instance to return.
        Returns:
        The appropriate instance of the given class.
        Throws:
        com.google.inject.ConfigurationException - If this injector cannot find or create the provider.
        com.google.inject.ProvisionException - If there was a runtime failure while providing an instance.