Module io.jooby
Package io.jooby

Interface Registry

All Known Subinterfaces:
Context, DefaultContext, Router, ServiceRegistry
All Known Implementing Classes:
ForwardingContext, Jooby

public interface Registry
Service locator pattern which may be provided by a dependency injection framework.
Since:
2.0.0
Author:
edgar
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    Provides an instance of the given type.
    <T> T
    require(Class<T> type)
    Provides an instance of the given type.
    <T> T
    require(Class<T> type, String name)
    Provides an instance of the given type where name matches it.
  • Method Details

    • require

      @NonNull <T> T require(@NonNull Class<T> type) throws RegistryException
      Provides an instance of the given type.
      Type Parameters:
      T - Object type.
      Parameters:
      type - Object type.
      Returns:
      Instance of this type.
      Throws:
      RegistryException - If there was a runtime failure while providing an instance.
    • require

      @NonNull <T> T require(@NonNull Class<T> type, @NonNull String name) throws RegistryException
      Provides an instance of the given type where name matches it.
      Type Parameters:
      T - Object type.
      Parameters:
      type - Object type.
      name - Object name.
      Returns:
      Instance of this type.
      Throws:
      RegistryException - If there was a runtime failure while providing an instance.
    • require

      @NonNull <T> T require(@NonNull ServiceKey<T> key) throws RegistryException
      Provides an instance of the given type.
      Type Parameters:
      T - Object type.
      Parameters:
      key - Object key.
      Returns:
      Instance of this type.
      Throws:
      RegistryException - If there was a runtime failure while providing an instance.