public class DIContainer extends Object
The container is thread-safe.
| Constructor and Description |
|---|
DIContainer()
Creates a new instance of
DIContainer. |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getInstance(Class<T> clazz)
Gets an instance of a class.
|
boolean |
isRegistered(Class<?> clazz)
Checks if an instance is registered for a class.
|
void |
register(Class<?> clazz,
Object inst)
Registers an instance for a class.
|
static void |
registerDefault(Class<?> clazz,
Supplier<Object> supplier)
Registers a default instance for a class.
|
public DIContainer()
DIContainer.public static void registerDefault(Class<?> clazz, Supplier<Object> supplier)
clazz - the classsupplier - supplier of the instancepublic void register(Class<?> clazz, Object inst)
clazz - the classinst - the instancepublic <T> T getInstance(Class<T> clazz)
T - the type of the classclazz - the classpublic boolean isRegistered(Class<?> clazz)
true.clazz - the classtrue if an instance is registered, false otherwiseCopyright © 1998–2025 Apryse Group NV. All rights reserved.