Package com.pyranid

Interface InstanceProvider

All Known Implementing Classes:
DefaultInstanceProvider

public interface InstanceProvider
Contract for a factory that creates instances given a type.

Useful for resultset mapping, where each row in the resultset might require a new instance.

Implementors are suggested to employ application-specific strategies, such as having a DI container handle instance creation.

Since:
1.0.0
Author:
Mark Allen
  • Method Summary

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

    • provide

      <T> T provide(Class<T> instanceClass)
      Provides an instance of the given instanceClass.

      Whether the instance is new every time or shared/reused is implementation-dependent.

      Type Parameters:
      T - instance type token
      Parameters:
      instanceClass - the type of instance to create
      Returns:
      an instance of the given instanceClass