Module dagger

Class SetFactory<T>

  • All Implemented Interfaces:
    Factory<java.util.Set<T>>, jakarta.inject.Provider<java.util.Set<T>>

    public final class SetFactory<T>
    extends java.lang.Object
    implements Factory<java.util.Set<T>>
    A Factory implementation used to implement Set bindings. This factory always returns a new Set instance for each call to get() (as required by Factory) whose elements are populated by subsequent calls to their Provider.get() methods.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  SetFactory.Builder<T>
      A builder to accumulate Provider<T> and Provider<Collection<T>> instances.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> SetFactory.Builder<T> builder​(int individualProviderSize, int collectionProviderSize)
      Constructs a new SetFactory.Builder for a SetFactory with individualProviderSize individual Provider<T> and collectionProviderSize Provider<Collection<T>> instances.
      static <T> Factory<java.util.Set<T>> empty()  
      java.util.Set<T> get()
      Returns a Set that contains the elements given by each of the providers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • empty

        public static <T> Factory<java.util.Set<T>> empty()
      • builder

        public static <T> SetFactory.Builder<T> builder​(int individualProviderSize,
                                                        int collectionProviderSize)
        Constructs a new SetFactory.Builder for a SetFactory with individualProviderSize individual Provider<T> and collectionProviderSize Provider<Collection<T>> instances.
      • get

        public java.util.Set<T> get()
        Returns a Set that contains the elements given by each of the providers.
        Specified by:
        get in interface jakarta.inject.Provider<T>
        Throws:
        java.lang.NullPointerException - if any of the delegate Set instances or elements therein are null