public class MockContainer extends Object implements Container
DEFAULT_NAME| Constructor and Description |
|---|
MockContainer() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getInstance(Class<T> type)
Convenience method. Equivalent to
getInstance(type,
DEFAULT_NAME). |
<T> T |
getInstance(Class<T> type,
String name)
Gets an instance of the given dependency which was declared in
ContainerBuilder. |
Set<String> |
getInstanceNames(Class<?> type)
Gets a set of all registered names for the given type
|
<T> T |
inject(Class<T> implementation)
Creates and injects a new instance of type
implementation. |
void |
inject(Object o)
Injects dependencies into the fields and methods of an existing object.
|
void |
removeScopeStrategy()
Removes the scope strategy for the current thread.
|
void |
setScopeStrategy(Scope.Strategy scopeStrategy)
Sets the scope strategy for the current thread.
|
public void inject(Object o)
Containerpublic <T> T inject(Class<T> implementation)
Containerimplementation.public <T> T getInstance(Class<T> type, String name)
ContainerContainerBuilder.getInstance in interface ContainerT - typetype - of dependencyname - of dependencypublic <T> T getInstance(Class<T> type)
ContainergetInstance(type,
DEFAULT_NAME).getInstance in interface ContainerT - typetype - of dependencypublic Set<String> getInstanceNames(Class<?> type)
ContainergetInstanceNames in interface Containertype - The instance typepublic void setScopeStrategy(Scope.Strategy scopeStrategy)
ContainersetScopeStrategy in interface ContainerscopeStrategy - scope strategypublic void removeScopeStrategy()
ContainerremoveScopeStrategy in interface ContainerCopyright © 2000–2018 Apache Software Foundation. All rights reserved.