Interface InstanceProvider

All Known Implementing Classes:
DefaultInstanceProvider
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Contract for concrete instance generation given type information.

See https://www.soklet.com/docs/instance-creation for detailed documentation.

Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    provide(Class<T> instanceClass)
    Vends an instance of the given class.
  • Method Details

    • provide

      @Nonnull <T> T provide(@Nonnull Class<T> instanceClass)
      Vends an instance of the given class.

      The instance does not necessarily have to be new for every invocation (for example, implementors might return cached instances).

      Type Parameters:
      T - the type of class to instantiate
      Parameters:
      instanceClass - type token which represents the class to instantiate
      Returns:
      an instance of T