T - type of unmanaged instancespublic class Unmanaged<T>
extends java.lang.Object
Helper class for injecting and calling lifecycle callbacks unmanaged instances for use by framework and library integrators.
Unmanaged<Foo> unmanagedFoo = new Unmanaged<Foo>(Foo.class); UnmanagedInstance<Foo> fooInstance = unmanagedFoo.newInstance(); Foo foo = fooInstance.produce().inject().postConstruct().get(); ... // Use the foo instance fooInstance.preDestroy().dispose();
An instance of this class can be safely held for the lifetime of the application.
Unmanaged.UnmanagedInstances created by this class are not suitable for sharing between threads.
CDI Lite implementations are not required to provide support for Unmanaged.
| Modifier and Type | Class and Description |
|---|---|
static class |
Unmanaged.UnmanagedInstance<T>
Represents a non-contextual instance.
|
| Constructor and Description |
|---|
Unmanaged(BeanManager manager,
java.lang.Class<T> clazz)
Create an injector for the given class
|
Unmanaged(java.lang.Class<T> clazz)
Create an injector for the given class, using the current bean manager
|
| Modifier and Type | Method and Description |
|---|---|
Unmanaged.UnmanagedInstance<T> |
newInstance()
Instantiate a new UnmanagedInstance
|
public Unmanaged(BeanManager manager, java.lang.Class<T> clazz)
manager - the BeanManagerclazz - class of the unmanaged instancespublic Unmanaged(java.lang.Class<T> clazz)
clazz - class of the unmanaged instancespublic Unmanaged.UnmanagedInstance<T> newInstance()
Unmanaged.UnmanagedInstance