public abstract class AppDependencyScope<T_Application extends android.app.Application> extends DependencyScope
AppDependencyScope provides an abstract base class for implementing an application
specific DependencyScope that has the same lifecycle as the application. An instance of
AppDependencyScope is not disposable.dependants, dependencies, dependencyProvider, initialized, mockScope, parentScope| Modifier | Constructor and Description |
|---|---|
protected |
AppDependencyScope(T_Application application) |
| Modifier and Type | Method and Description |
|---|---|
T_Application |
getApplication()
Gets the
Application. |
android.content.Context |
getApplicationContext()
Gets the application
Context. |
protected <T> T |
getDependency()
This method is meant to be implemented by each concrete implementation of
DependencyScope. |
static <T extends AppDependencyScope> |
getInstance()
Gets the singleton instance of
AppDependencyScope. |
boolean |
isAppScope()
Tests if this
DependencyScope is a application scoped DependencyScope. |
boolean |
isDisposable()
Overrides to return a
boolean value false because an instance of
AppDependencyScope is not disposable. |
addDependant, cache, createDependencyProvider, dependency, dispose, getDependencies, getDependency, getDependencyProvider, getId, getMockedScope, getOwner, getParentScope, hasDependency, hasDependency, initialize, onActivated, onDeactivated, removeDependant, removeDependency, setMockedScope, setOwner, setParentScope, typeprotected AppDependencyScope(T_Application application)
public static <T extends AppDependencyScope> T getInstance()
AppDependencyScope. A singleton instance of
concreate implementation of AppDependencyScope should be created by an
Application.T - The parameter type extending AppDependencyScope.AppDependencyScope.protected <T> T getDependency()
DependencyScopeDependencyScope.
The requested dependency instance is returned by the implementation, if it is capable of providing
a such instance. The implementation of this method should not delegate the request to any other
DependencyScope. If the implementation is not able to cache the requested instance,
the design contract is to return null instead.getDependency in class DependencyScopeT - A type parameter for casting the requested instance to expected type.DependencyScope implementation is
capable of providing such instance otherwise null. This default implementation returns
null.public final android.content.Context getApplicationContext()
Context.Context.public final T_Application getApplication()
Application.Application.public final boolean isAppScope()
DependencyScopeDependencyScope is a application scoped DependencyScope.isAppScope in class DependencyScopeboolean,public final boolean isDisposable()
boolean value false because an instance of
AppDependencyScope is not disposable.isDisposable in class DependencyScopeboolean value false.