Top Description Inners Fields Constructors Methods
com.google.inject.internal

pack-priv final Class InternalProviderInstanceBindingImpl<T>

extends ProviderInstanceBindingImpl<T>
implements DelayedInitialize
Class Inheritance
All Implemented Interfaces
com.google.inject.internal.DelayedInitialize
Imports
com.google.common.collect.ImmutableSet, com.google.inject.Key, .Provider, com.google.inject.internal.ProvisionListenerStackCallback.ProvisionCallback, com.google.inject.spi.Dependency, .HasDependencies, .InjectionPoint, .ProviderWithExtensionVisitor

A ProviderInstanceBindingImpl for implementing 'native' guice extensions.

Beyond the normal binding contract that is mostly handled by our baseclass, this also implements DelayedInitialize in order to initialize factory state.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract static class
InternalProviderInstanceBindingImpl.CyclicFactory<T>

An base factory implementation that can be extended to provide a specialized implementation of a ProviderWithExtensionVisitor and also implements InternalFactory

pack-priv abstract static class
InternalProviderInstanceBindingImpl.Factory<T>

A base factory implementation.

pack-priv static enum

Field Summary

Modifier and TypeField and Description
private final InternalProviderInstanceBindingImpl.Factory<T>
Inherited from com.google.inject.internal.ProviderInstanceBindingImpl:
injectionPointsproviderInstance

Constructor Summary

AccessConstructor and Description
pack-priv
InternalProviderInstanceBindingImpl(InjectorImpl injector, Key<T> key, Object source, InternalProviderInstanceBindingImpl.Factory<T> originalFactory, InternalFactory<? extends T> scopedFactory, Scoping scoping)

Method Summary

Modifier and TypeMethod and Description
pack-priv InternalProviderInstanceBindingImpl.InitializationTiming
public void
initialize(final InjectorImpl injector, final Errors errors)

Implements com.google.inject.internal.DelayedInitialize.initialize.

Initializes this binding, throwing any errors if necessary.
Inherited from com.google.inject.internal.ProviderInstanceBindingImpl:
acceptTargetVisitorapplyToequalsgetDependenciesgetInjectionPointsgetProviderInstancegetUserSuppliedProviderhashCodetoStringwithKeywithScoping

Field Detail

originalFactoryback to summary
private final InternalProviderInstanceBindingImpl.Factory<T> originalFactory

Constructor Detail

InternalProviderInstanceBindingImplback to summary
pack-priv InternalProviderInstanceBindingImpl(InjectorImpl injector, Key<T> key, Object source, InternalProviderInstanceBindingImpl.Factory<T> originalFactory, InternalFactory<? extends T> scopedFactory, Scoping scoping)

Method Detail

getInitializationTimingback to summary
pack-priv InternalProviderInstanceBindingImpl.InitializationTiming getInitializationTiming()
initializeback to summary
public void initialize(final InjectorImpl injector, final Errors errors) throws ErrorsException

Implements com.google.inject.internal.DelayedInitialize.initialize.

Doc from com.google.inject.internal.DelayedInitialize.initialize.

Initializes this binding, throwing any errors if necessary.

Annotations
@Override
com.google.inject.internal back to summary

pack-priv abstract Class InternalProviderInstanceBindingImpl.CyclicFactory<T>

extends InternalProviderInstanceBindingImpl.Factory<T>
Class Inheritance
Known Direct Subclasses
com.google.inject.internal.ProviderMethod

An base factory implementation that can be extended to provide a specialized implementation of a ProviderWithExtensionVisitor and also implements InternalFactory

Field Summary

Inherited from com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory:
provisionCallback

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final T
get(final InternalContext
of this injection
context
,
final Dependency<?> dependency, boolean
true if getting as a result of a linked binding
linked
)

Overrides com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory.get.

Implements com.google.inject.internal.InternalFactory.get.

Creates an object to be injected.
private T
provision(Dependency<?> dependency, InternalContext context, ConstructionContext<T> constructionContext)

Inherited from com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory:
doProvisiongetgetSourceinitialize

Constructor Detail

CyclicFactoryback to summary
pack-priv CyclicFactory(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming)

Method Detail

getback to summary
public final T get(final InternalContext context, final Dependency<?> dependency, boolean linked) throws InternalProvisionException

Overrides com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory.get.

Implements com.google.inject.internal.InternalFactory.get.

Doc from com.google.inject.internal.InternalFactory.get.

Creates an object to be injected.

Parameters
context:InternalContext

of this injection

linked:boolean

true if getting as a result of a linked binding

Returns:T

instance that was created

Annotations
@Override
Exceptions
InternalProvisionException:
if a value cannot be provided
provisionback to summary
private T provision(Dependency<?> dependency, InternalContext context, ConstructionContext<T> constructionContext) throws InternalProvisionException
com.google.inject.internal back to summary

pack-priv abstract Class InternalProviderInstanceBindingImpl.Factory<T>

extends Object
implements InternalFactory<T>, Provider<T>, HasDependencies
Class Inheritance
  • java.lang.Object
  • com.google.inject.internal.InternalProviderInstanceBindingImpl.Factory
All Implemented Interfaces
com.google.inject.spi.HasDependencies, com.google.inject.Provider, jakarta.inject.Provider, com.google.inject.internal.InternalFactory
Known Direct Subclasses
com.google.inject.internal.InternalProviderInstanceBindingImpl.CyclicFactory, com.google.inject.internal.RealMapBinder.ProviderMapEntry, com.google.inject.internal.RealMapBinder.RealMapBinderProviderWithDependencies, com.google.inject.internal.RealMapBinder.RealMultimapBinderProviderWithDependencies, com.google.inject.internal.RealMultibinder.BaseFactory, com.google.inject.internal.RealOptionalBinder.RealOptionalBinderProviderWithDependencies

A base factory implementation. Any Factories that delegate to other bindings should use the CyclicFactory subclass, but trivial factories can use this one.

Field Summary

Modifier and TypeField and Description
private Provider<T>
private final InternalProviderInstanceBindingImpl.InitializationTiming
pack-priv ProvisionListenerStackCallback<T>
private Object

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected abstract T

Returns:

instance to be injected
doProvision
(InternalContext context, Dependency<?> dependency)

Creates an object to be injected.

public final T
get()

Implements com.google.inject.Provider.get.

Provides an instance of T.
public T
get(final InternalContext
of this injection
context
,
final Dependency<?> dependency, boolean
true if getting as a result of a linked binding
linked
)

Implements com.google.inject.internal.InternalFactory.get.

Creates an object to be injected.
pack-priv final Object
getSource()

The binding source.

pack-priv abstract void
initialize(InjectorImpl injector, Errors errors)

A callback that allows for implementations to fetch dependencies on other bindings.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateProviderback to summary
private Provider<T> delegateProvider
initializationTimingback to summary
private final InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming
provisionCallbackback to summary
pack-priv ProvisionListenerStackCallback<T> provisionCallback
sourceback to summary
private Object source

Constructor Detail

Factoryback to summary
pack-priv Factory(InternalProviderInstanceBindingImpl.InitializationTiming initializationTiming)

Method Detail

doProvisionback to summary
protected abstract T doProvision(InternalContext context, Dependency<?> dependency) throws InternalProvisionException

Creates an object to be injected.

Returns:T

instance to be injected

Exceptions
InternalProvisionException:
if a value cannot be provided
getback to summary
public final T get()

Implements com.google.inject.Provider.get.

Doc from com.google.inject.Provider.get.

Provides an instance of T.

Returns:T

Doc from jakarta.inject.Provider.get.

instance of T.

Annotations
@Override
getback to summary
public T get(final InternalContext context, final Dependency<?> dependency, boolean linked) throws InternalProvisionException

Implements com.google.inject.internal.InternalFactory.get.

Doc from com.google.inject.internal.InternalFactory.get.

Creates an object to be injected.

Parameters
context:InternalContext

of this injection

linked:boolean

true if getting as a result of a linked binding

Returns:T

instance that was created

Annotations
@Override
Exceptions
InternalProvisionException:
if a value cannot be provided
getSourceback to summary
pack-priv final Object getSource()

The binding source.

May be useful for augmenting runtime error messages.

Note

this will return null until initialize(InjectorImpl, Errors) has already been called.

initializeback to summary
pack-priv abstract void initialize(InjectorImpl injector, Errors errors) throws ErrorsException

A callback that allows for implementations to fetch dependencies on other bindings.

Will be called exactly once, prior to any call to doProvision.

com.google.inject.internal back to summary

pack-priv final Enum InternalProviderInstanceBindingImpl.InitializationTiming

extends Enum<InternalProviderInstanceBindingImpl.InitializationTiming>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final InternalProviderInstanceBindingImpl.InitializationTiming
DELAYED

Initialization of this factory should be delayed until after all other static initialization completes.

public static final InternalProviderInstanceBindingImpl.InitializationTiming
EAGER

This factory can be initialized eagerly.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static InternalProviderInstanceBindingImpl.InitializationTiming
public static InternalProviderInstanceBindingImpl.InitializationTiming[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DELAYEDback to summary
public static final InternalProviderInstanceBindingImpl.InitializationTiming DELAYED

Initialization of this factory should be delayed until after all other static initialization completes. This will be useful for factories that need to call InjectorImpl#getExistingBinding(Key) to not create jit bindings, but also want to be able to conditionally consume jit bindings created by other other bindings.

EAGERback to summary
public static final InternalProviderInstanceBindingImpl.InitializationTiming EAGER

This factory can be initialized eagerly. This should be the case for most things.

Constructor Detail

InitializationTimingback to summary
private InitializationTiming()

Method Detail

valueOfback to summary
public static InternalProviderInstanceBindingImpl.InitializationTiming valueOf(String name)
valuesback to summary
public static InternalProviderInstanceBindingImpl.InitializationTiming[] values()