Package com.google.inject.internal
Class ProviderMethodsModule
java.lang.Object
com.google.inject.internal.ProviderMethodsModule
- All Implemented Interfaces:
Module
Creates bindings to methods annotated with @
Provides
. Use the scope and
binding annotations on the provider method to configure the binding.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Object
private final ModuleAnnotatedMethodScanner
private final boolean
private final TypeLiteral<?>
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ProviderMethodsModule
(Object delegate, boolean skipFastClassGeneration, ModuleAnnotatedMethodScanner scanner) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Contributes bindings and other configurations for this module tobinder
.private <T> ProviderMethod<T>
createProviderMethod
(Binder binder, Method method, Annotation annotation) boolean
static Module
Returns a module which creates bindings for provider methods from the given module.static Module
forModule
(Object module, ModuleAnnotatedMethodScanner scanner) Returns a module which creates bindings methods in the module that match the scanner.static Module
Returns a module which creates bindings for provider methods from the given object.private static Module
forObject
(Object object, boolean skipFastClassGeneration, ModuleAnnotatedMethodScanner scanner) private Annotation
getAnnotation
(Binder binder, Method method) Returns the annotation that is claimed by the scanner, or null if there is none.Class<?>
(package private) <T> Key<T>
getKey
(Errors errors, TypeLiteral<T> type, Member member, Annotation[] annotations) List<ProviderMethod<?>>
getProviderMethods
(Binder binder) int
hashCode()
boolean
Is it scanning the built-in @Provides* methods.private boolean
private static boolean
Returns true if a overrides b, assumes that the signatures match
-
Field Details
-
delegate
-
typeLiteral
-
skipFastClassGeneration
private final boolean skipFastClassGeneration -
scanner
-
-
Constructor Details
-
ProviderMethodsModule
private ProviderMethodsModule(Object delegate, boolean skipFastClassGeneration, ModuleAnnotatedMethodScanner scanner)
-
-
Method Details
-
forModule
Returns a module which creates bindings for provider methods from the given module. -
forModule
Returns a module which creates bindings methods in the module that match the scanner. -
forObject
Returns a module which creates bindings for provider methods from the given object. This is useful notably for GINThis will skip bytecode generation for provider methods, since it is assumed that callers are only interested in Module metadata.
-
forObject
private static Module forObject(Object object, boolean skipFastClassGeneration, ModuleAnnotatedMethodScanner scanner) -
getDelegateModuleClass
-
isStaticModule
private boolean isStaticModule() -
configure
Description copied from interface:Module
Contributes bindings and other configurations for this module tobinder
.Do not invoke this method directly to install submodules. Instead use
Binder.install(Module)
, which ensures thatprovider methods
are discovered. -
getProviderMethods
-
getAnnotation
Returns the annotation that is claimed by the scanner, or null if there is none. -
overrides
Returns true if a overrides b, assumes that the signatures match -
createProviderMethod
private <T> ProviderMethod<T> createProviderMethod(Binder binder, Method method, Annotation annotation) -
getKey
-
equals
-
hashCode
public int hashCode() -
isScanningBuiltInProvidesMethods
public boolean isScanningBuiltInProvidesMethods()Is it scanning the built-in @Provides* methods. -
getScanner
-