java.lang.Object | |
↳ | com.google.inject.Scopes |
Built-in scope implementations.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Scope | NO_SCOPE | No scope; the same as not applying any scope at all. | |||||||||
Scope | SINGLETON | One instance per Injector . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns true if the object is a proxy for a circular dependency,
constructed by Guice because it encountered a circular dependency.
| |||||||||||
Returns true if
binding has the given scope. | |||||||||||
Returns true if
binding is singleton-scoped. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
No scope; the same as not applying any scope at all. Each time the Injector obtains an instance of an object with "no scope", it injects this instance then immediately forgets it. When the next request for the same binding arrives it will need to obtain the instance over again.
This exists only in case a class has been annotated with a scope
annotation such as @Singleton
, and you need to override
this to "no scope" in your binding.
Returns true if the object is a proxy for a circular dependency, constructed by Guice because it encountered a circular dependency. Scope implementations should be careful to not cache circular proxies, because the proxies are not intended for general purpose use. (They are designed just to fulfill the immediate injection, not all injections. Caching them can lead to IllegalArgumentExceptions or ClassCastExceptions.)
Returns true if binding
has the given scope. If the binding is a linked key binding
and belongs to an injector (ie. it
was retrieved via Injector.getBinding()
), then this method will
also true if the target binding has the given scope.
binding | binding to check |
---|---|
scope | scope implementation instance |
scopeAnnotation | scope annotation class |
Returns true if binding
is singleton-scoped. If the binding is a linked key binding
and belongs to an injector (ie. it
was retrieved via Injector.getBinding()
), then this method will
also true if the target binding is singleton-scoped.