Package com.google.inject.internal
Class ProvisionListenerCallbackStore
- java.lang.Object
-
- com.google.inject.internal.ProvisionListenerCallbackStore
-
final class ProvisionListenerCallbackStore extends java.lang.ObjectProvisionListenerStackCallbackfor each key.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classProvisionListenerCallbackStore.KeyBindingA struct that holds key & binding but uses just key for equality/hashcode.
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.cache.LoadingCache<ProvisionListenerCallbackStore.KeyBinding,ProvisionListenerStackCallback<?>>cacheprivate static com.google.common.collect.ImmutableSet<Key<?>>INTERNAL_BINDINGSprivate com.google.common.collect.ImmutableList<ProvisionListenerBinding>listenerBindings
-
Constructor Summary
Constructors Constructor Description ProvisionListenerCallbackStore(java.util.List<ProvisionListenerBinding> listenerBindings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private <T> ProvisionListenerStackCallback<T>create(Binding<T> binding)Creates a newProvisionListenerStackCallbackwith the correct listeners for the key.<T> ProvisionListenerStackCallback<T>get(Binding<T> binding)Returns a newProvisionListenerStackCallbackfor the key ornullif there are no listeners(package private) booleanremove(Binding<?> type)Purges a key from the cache.
-
-
-
Field Detail
-
INTERNAL_BINDINGS
private static final com.google.common.collect.ImmutableSet<Key<?>> INTERNAL_BINDINGS
-
listenerBindings
private final com.google.common.collect.ImmutableList<ProvisionListenerBinding> listenerBindings
-
cache
private final com.google.common.cache.LoadingCache<ProvisionListenerCallbackStore.KeyBinding,ProvisionListenerStackCallback<?>> cache
-
-
Constructor Detail
-
ProvisionListenerCallbackStore
ProvisionListenerCallbackStore(java.util.List<ProvisionListenerBinding> listenerBindings)
-
-
Method Detail
-
get
public <T> ProvisionListenerStackCallback<T> get(Binding<T> binding)
Returns a newProvisionListenerStackCallbackfor the key ornullif there are no listeners
-
remove
boolean remove(Binding<?> type)
Purges a key from the cache. Use this only if the type is not actually valid for binding and needs to be purged. (See issue 319 and ImplicitBindingTest#testCircularJitBindingsLeaveNoResidue and #testInstancesRequestingProvidersForThemselvesWithChildInjectors for examples of when this is necessary.)Returns true if the type was stored in the cache, false otherwise.
-
create
private <T> ProvisionListenerStackCallback<T> create(Binding<T> binding)
Creates a newProvisionListenerStackCallbackwith the correct listeners for the key.
-
-