public class Injections extends Object
Constructor and Description |
---|
Injections() |
Modifier and Type | Method and Description |
---|---|
static InjectionManager |
createInjectionManager()
Creates an
InjectionManager without parent and initial binder. |
static InjectionManager |
createInjectionManager(Binder binder)
Creates a
InjectionManager with initial binder that is immediately registered. |
static InjectionManager |
createInjectionManager(Object parent)
Creates an unnamed, parented
InjectionManager . |
static InjectionManager |
createInjectionManager(RuntimeType type)
Creates an
InjectionManager without parent and initial binder. |
static <T> T |
getOrCreate(InjectionManager injectionManager,
Class<T> clazz)
Get the class by contract or create and inject a new instance.
|
public static InjectionManager createInjectionManager()
InjectionManager
without parent and initial binder.public static InjectionManager createInjectionManager(RuntimeType type)
InjectionManager
without parent and initial binder.type
- RuntimeType
the InjectionManagerFactory
must be ConstrainedTo
if annotated.public static InjectionManager createInjectionManager(Binder binder)
InjectionManager
with initial binder that is immediately registered.binder
- custom the binder
.public static InjectionManager createInjectionManager(Object parent)
InjectionManager
. In case the parent
injection manager is not specified, the
locator will not be parented.parent
- The parent of this injection manager. Services can be found in the parent (and all grand-parents). May be
null
. An underlying DI provider checks whether the parent is in a proper type.public static <T> T getOrCreate(InjectionManager injectionManager, Class<T> clazz)
T
- instance type.injectionManager
- DI injection manager.clazz
- class of the instance to be provider.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.