Interface MultiBinder<T>

Type Parameters:
T - the element type

public interface MultiBinder<T>
Accumulates multiple bindings for the same type, making them injectable as Set, Collection, Iterable, Stream, or List. Obtain a MultiBinder via Binder.bindSet(Class).

Calling Binder.bindSet(Class) multiple times for the same element type (e.g. from two different Modules) returns the same underlying binder so entries accumulate naturally across modules.

Since:
Apr-2026
Author:
reed.vonredwitz
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Class<? extends T> implementationClass)
    Adds a binding by implementation class, which is instantiated via the Context at injection time.
    add(Supplier<? extends T> supplier)
    Adds a binding via supplier, which is called at injection time to produce the value.
    add(T value)
    Adds a pre-constructed value to the set.
  • Method Details

    • add

      MultiBinder<T> add(T value)
      Adds a pre-constructed value to the set.
      Parameters:
      value - the value
      Returns:
      this MultiBinder for chaining
    • add

      MultiBinder<T> add(Class<? extends T> implementationClass)
      Adds a binding by implementation class, which is instantiated via the Context at injection time.
      Parameters:
      implementationClass - the implementation class
      Returns:
      this MultiBinder for chaining
    • add

      MultiBinder<T> add(Supplier<? extends T> supplier)
      Adds a binding via supplier, which is called at injection time to produce the value.
      Parameters:
      supplier - the supplier
      Returns:
      this MultiBinder for chaining