Package jakarta.enterprise.inject.spi
Class Unmanaged<T>
- java.lang.Object
-
- jakarta.enterprise.inject.spi.Unmanaged<T>
-
- Type Parameters:
T- type of unmanaged instances
public class Unmanaged<T> extends 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.- Since:
- 1.1
- Author:
- Pete Muir
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUnmanaged.UnmanagedInstance<T>Represents a non-contextual instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Unmanaged.UnmanagedInstance<T>newInstance()Instantiate a new UnmanagedInstance
-
-
-
Constructor Detail
-
Unmanaged
public Unmanaged(BeanManager manager, Class<T> clazz)
Create an injector for the given class- Parameters:
manager- theBeanManagerclazz- class of the unmanaged instances
-
-
Method Detail
-
newInstance
public Unmanaged.UnmanagedInstance<T> newInstance()
Instantiate a new UnmanagedInstance- Returns:
- a new
Unmanaged.UnmanagedInstance
-
-