IndexedBinding that can be used to emulate the binding
deduplication that Guice internally performs.Note
simply using equals/hashCode on the BindingImpls doesn't work because they all have
unique annotations. This works around that by reimplementing equality semantics that ignores
Element#uniqueId(). A better solution might be to introduce the idea of an 'anonymous'
binding to guice, that might support this usecase directly.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static enum | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Object | |
| pack-priv final Injector |
| EAGER_SINGLETON | back to summary |
|---|---|
| private static final Object EAGER_SINGLETON | |
| injector | back to summary |
|---|---|
| pack-priv final Injector injector | |
| Indexer | back to summary |
|---|---|
| pack-priv Indexer(Injector injector) | |
| isIndexable | back to summary |
|---|---|
| pack-priv boolean isIndexable(Binding<?> binding) | |
| scope | back to summary |
|---|---|
| private Object scope(Binding<?> binding) | |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a constructor binding. To resolve injections, an instance is instantiated by invoking
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a binding created from converting a bound instance to a new type. The source binding has the same binding annotation but a different type. This target is found only on injector bindings.
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a binding to a key exposed from an enclosed private environment. This target is only found in injector bindings.
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a instance binding. The same instance is returned for every injection. This target is found in both module and injector bindings.
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a linked key binding. The other key's binding is used to resolve injections. This target is found in both module and injector bindings.
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a binding to a
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a provider instance binding. The provider's
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit a provider key binding. To resolve injections, the provider key is first resolved, then
that provider's
| |
| visit | back to summary |
|---|---|
| public Indexer. Overrides com. Implements com. Doc from com. Visit an untargetted binding. This target is found only on module bindings. It indicates that the injector should use its implicit binding strategies to resolve injections.
| |
| visitEagerSingleton | back to summary |
|---|---|
| public Object visitEagerSingleton() Implements com. Doc from com. Visit an eager singleton or single instance. This scope strategy is found on both module and injector bindings.
| |
| visitNoScoping | back to summary |
|---|---|
| public Object visitNoScoping() Implements com. Doc from com. Visit an unspecified or unscoped strategy. On a module, this strategy indicates that the injector should use scoping annotations to find a scope. On an injector, it indicates that no scope is applied to the binding. An unscoped binding will behave like a scoped one when it is linked to a scoped binding.
| |
| visitScope | back to summary |
|---|---|
| public Object visitScope(Scope scope) Implements com. Doc from com. Visit a scope instance. This scope strategy is found on both module and injector bindings.
| |
| visitScopeAnnotation | back to summary |
|---|---|
| public Object visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation) Implements com. Doc from com. Visit a scope annotation. This scope strategy is found only on module bindings. The instance
that implements this scope is registered by
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Indexer. | |
| public static final Indexer. | |
| public static final Indexer. | |
| public static final Indexer. | |
| public static final Indexer. | |
| public static final Indexer. | |
| public static final Indexer. | |
| public static final Indexer. | |
| public static final Indexer. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Indexer. | |
| public static Indexer. |
| CONSTANT | back to summary |
|---|---|
| public static final Indexer. | |
| CONSTRUCTOR | back to summary |
|---|---|
| public static final Indexer. | |
| EXPOSED | back to summary |
|---|---|
| public static final Indexer. | |
| INSTANCE | back to summary |
|---|---|
| public static final Indexer. | |
| LINKED_KEY | back to summary |
|---|---|
| public static final Indexer. | |
| PROVIDED_BY | back to summary |
|---|---|
| public static final Indexer. | |
| PROVIDER_INSTANCE | back to summary |
|---|---|
| public static final Indexer. | |
| PROVIDER_KEY | back to summary |
|---|---|
| public static final Indexer. | |
| UNTARGETTED | back to summary |
|---|---|
| public static final Indexer. | |
| BindingType | back to summary |
|---|---|
| private BindingType() | |
| valueOf | back to summary |
|---|---|
| public static Indexer. | |
| values | back to summary |
|---|---|
| public static Indexer. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final String | |
| pack-priv final Element. | |
| pack-priv final Object | |
| pack-priv final Object | |
| pack-priv final Indexer. | |
| pack-priv final TypeLiteral |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public int |
| annotationName | back to summary |
|---|---|
| pack-priv final String annotationName | |
| annotationType | back to summary |
|---|---|
| pack-priv final Element. | |
| extraEquality | back to summary |
|---|---|
| pack-priv final Object extraEquality | |
| scope | back to summary |
|---|---|
| pack-priv final Object scope | |
| type | back to summary |
|---|---|
| pack-priv final Indexer. | |
| typeLiteral | back to summary |
|---|---|
| pack-priv final TypeLiteral<?> typeLiteral | |
| IndexedBinding | back to summary |
|---|---|
| pack-priv IndexedBinding(Binding<?> binding, Indexer. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |