Class ProviderMethodsModule

java.lang.Object
com.google.inject.internal.ProviderMethodsModule
All Implemented Interfaces:
Module

public final class ProviderMethodsModule extends Object implements Module
Creates bindings to methods annotated with @Provides. Use the scope and binding annotations on the provider method to configure the binding.
Author:
crazybob@google.com (Bob Lee), jessewilson@google.com (Jesse Wilson)
  • Method Details

    • forModule

      public static Module forModule(Module module)
      Returns a module which creates bindings for provider methods from the given module.
    • forModule

      public static Module forModule(Object module, ModuleAnnotatedMethodScanner scanner)
      Returns a module which creates bindings methods in the module that match the scanner.
    • forObject

      public static Module forObject(Object object)
      Returns a module which creates bindings for provider methods from the given object. This is useful notably for GIN

      This will skip bytecode generation for provider methods, since it is assumed that callers are only interested in Module metadata.

    • getDelegateModuleClass

      public Class<?> getDelegateModuleClass()
    • configure

      public void configure(Binder binder)
      Description copied from interface: Module
      Contributes bindings and other configurations for this module to binder.

      Do not invoke this method directly to install submodules. Instead use Binder.install(Module), which ensures that provider methods are discovered.

      Specified by:
      configure in interface Module
    • getProviderMethods

      public List<ProviderMethod<?>> getProviderMethods(Binder binder)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isScanningBuiltInProvidesMethods

      public boolean isScanningBuiltInProvidesMethods()
      Is it scanning the built-in @Provides* methods.
    • getScanner

      public ModuleAnnotatedMethodScanner getScanner()