|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the type of object this provider providespublic interface Provider<T>
Simply, any object capable of providing instances of type T
.
Providers are used in numerous ways by the Guice framework:
Provider
instead, to control exactly how
Guice creates or obtains instances for the binding.
Provider<T>
instance injected, rather than having a T
injected directly. This
may give you access to multiple instances, instances you wish to safely
mutate and discard, instances which are out of scope (e.g. using a
@RequestScoped
object from within a @SessionScoped
object),
or instances you don't want to initialize until they are absolutely needed.
Scope
is implemented as a decorator of
Provider<T>
, which decides when to delegate to the backing provider
and when to provide the instance some other way.
Injector
offers access to the Provider<T>
it uses
to fulfill requests for a given key, via the Injector.getProvider(com.google.inject.Key)
methods.
Method Summary | |
---|---|
T |
get()
Provides an instance of T . |
Method Detail |
---|
T get()
T
. Must never return null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |