public final class Linker extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Linker.ErrorHandler
Handles linker errors appropriately.
|
| Constructor and Description |
|---|
Linker(Linker base,
Loader plugin,
Linker.ErrorHandler errorHandler) |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Binding<?>> |
fullyLinkedBindings()
|
void |
installBindings(BindingsGroup toInstall)
Adds all bindings in
toInstall. |
Map<String,Binding<?>> |
linkAll()
Links all known bindings (whether requested or installed), plus all of their
transitive dependencies.
|
void |
linkRequested()
Links all requested bindings plus their transitive dependencies.
|
Binding<?> |
requestBinding(String key,
Object requiredBy)
Deprecated.
Older, generated code still using this should be re-generated.
|
Binding<?> |
requestBinding(String key,
Object requiredBy,
boolean mustHaveInjections,
boolean library)
Deprecated.
Older, generated code still using this should be re-generated.
|
Binding<?> |
requestBinding(String key,
Object requiredBy,
ClassLoader classLoader)
Returns the binding if it exists immediately.
|
Binding<?> |
requestBinding(String key,
Object requiredBy,
ClassLoader classLoader,
boolean mustHaveInjections,
boolean library)
Returns the binding if it exists immediately.
|
public Linker(Linker base, Loader plugin, Linker.ErrorHandler errorHandler)
public void installBindings(BindingsGroup toInstall)
toInstall. The caller must call either linkAll() or requestBinding(java.lang.String, java.lang.Object) and linkRequested() before the
bindings can be used.
This method may only be called before linkAll(). Subsequent calls to
installBindings(BindingsGroup) will throw an IllegalStateException.public Map<String,Binding<?>> linkAll()
AssertionError - if this method is not called within a synchronized block which
holds this Linker as the lock object.public void linkRequested()
AssertionError - if this method is not called within a synchronized block which
holds this Linker as the lock object.@Deprecated public Binding<?> requestBinding(String key, Object requiredBy)
public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader)
@Deprecated public Binding<?> requestBinding(String key, Object requiredBy, boolean mustHaveInjections, boolean library)
public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader, boolean mustHaveInjections, boolean library)
mustHaveInjections - true if the the referenced key requires either an
@Inject annotation is produced by a @Provides method.
This isn't necessary for Module.injects types because frameworks need
to inject arbitrary classes like JUnit test cases and Android
activities. It also isn't necessary for supertypes.Copyright © 2024 Square, Inc.. All rights reserved.