Package javax.enterprise.inject.spi
Class Unmanaged.UnmanagedInstance<T>
- java.lang.Object
-
- javax.enterprise.inject.spi.Unmanaged.UnmanagedInstance<T>
-
- Type Parameters:
T- the type of the CDI instance to create
public static class Unmanaged.UnmanagedInstance<T> extends java.lang.ObjectThis basically delegates to theInjectionTargetinterface
-
-
Field Summary
Fields Modifier and Type Field Description private BeanManagerbeanManagerprivate CreationalContext<T>creationalContextprivate booleandisposedprivate booleaninjectedprivate InjectionTarget<T>injectionTargetprivate Tinstance
-
Constructor Summary
Constructors Modifier Constructor Description privateUnmanagedInstance(BeanManager beanManager, InjectionTarget<T> injectionTarget)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbasicCheck()Check whether the UnmanagedInstance is already initialized and not yet disposed.Unmanaged.UnmanagedInstance<T>dispose()Dispose the CDI instance.Tget()This method should only get called after the CDI instance got properly produced and initialized viaproduce()inject()postConstruct()Unmanaged.UnmanagedInstance<T>inject()Fill @inject field, constructor and methods.Unmanaged.UnmanagedInstance<T>postConstruct()Invoke any @PostConstruct methods.Unmanaged.UnmanagedInstance<T>preDestroy()Invoke any @PreDestroy annotated methods and interceptors of the given CDI instance.Unmanaged.UnmanagedInstance<T>produce()Create the CDI instance itself.
-
-
-
Field Detail
-
beanManager
private BeanManager beanManager
-
injectionTarget
private InjectionTarget<T> injectionTarget
-
creationalContext
private CreationalContext<T> creationalContext
-
instance
private T instance
-
injected
private boolean injected
-
disposed
private boolean disposed
-
-
Constructor Detail
-
UnmanagedInstance
private UnmanagedInstance(BeanManager beanManager, InjectionTarget<T> injectionTarget)
-
-
Method Detail
-
produce
public Unmanaged.UnmanagedInstance<T> produce()
Create the CDI instance itself. This internally just callsProducer.produce(javax.enterprise.context.spi.CreationalContext)and performs a few checks upfront.- Throws:
java.lang.IllegalStateException- if the instance already got createdjava.lang.IllegalStateException- if the instance already got disposed
-
inject
public Unmanaged.UnmanagedInstance<T> inject()
Fill @inject field, constructor and methods.- Throws:
java.lang.IllegalStateException- if the instance was not yet createdjava.lang.IllegalStateException- if the instance already got injectedjava.lang.IllegalStateException- if the instance already got disposed- See Also:
InjectionTarget.inject(Object, javax.enterprise.context.spi.CreationalContext)
-
postConstruct
public Unmanaged.UnmanagedInstance<T> postConstruct()
Invoke any @PostConstruct methods.- See Also:
InjectionTarget.postConstruct(Object)
-
get
public T get()
This method should only get called after the CDI instance got properly produced and initialized viaproduce()inject()postConstruct()- Returns:
- the filled cdi instance
-
preDestroy
public Unmanaged.UnmanagedInstance<T> preDestroy()
Invoke any @PreDestroy annotated methods and interceptors of the given CDI instance.
-
dispose
public Unmanaged.UnmanagedInstance<T> dispose()
Dispose the CDI instance. One should callpreDestroy()before this method.- See Also:
Producer.dispose(Object)
-
basicCheck
private void basicCheck()
Check whether the UnmanagedInstance is already initialized and not yet disposed.
-
-