Package javax.enterprise.inject.spi
Class Unmanaged<T>
- java.lang.Object
-
- javax.enterprise.inject.spi.Unmanaged<T>
-
- Type Parameters:
T
- the type of the CDI instance to create
public class Unmanaged<T> extends java.lang.Object
Helper class for manually maintaining CDI created instances which are not managed by the CDI container. Be aware that instances created that way are not managed by the CDI container and thus need to be cleaned up manually to not create memory leaks!. Normal code shall useInstance
if possible. The reason for using UnmanagedInstance is for @Dependent scoped instances which should not pollute theCreationalContext
of the containing instance. Note that the methods of UnmanagedInstance needs to be called in a well defined order. Please note that this classes are not thread safe!- Since:
- 1.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Unmanaged.UnmanagedInstance<T>
This basically delegates to theInjectionTarget
interface
-
Field Summary
Fields Modifier and Type Field Description private BeanManager
beanManager
private InjectionTarget<T>
injectionTarget
-
Constructor Summary
Constructors Constructor Description Unmanaged(java.lang.Class<T> clazz)
Unmanaged(BeanManager beanManager, java.lang.Class<T> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Unmanaged.UnmanagedInstance<T>
newInstance()
-
-
-
Field Detail
-
beanManager
private BeanManager beanManager
-
injectionTarget
private InjectionTarget<T> injectionTarget
-
-
Constructor Detail
-
Unmanaged
public Unmanaged(java.lang.Class<T> clazz)
-
Unmanaged
public Unmanaged(BeanManager beanManager, java.lang.Class<T> clazz)
-
-
Method Detail
-
newInstance
public Unmanaged.UnmanagedInstance<T> newInstance()
-
-