Class BeanManagerInstanceCreator
- java.lang.Object
-
- org.eclipse.yasson.internal.components.BeanManagerInstanceCreator
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,JsonbComponentInstanceCreator
public class BeanManagerInstanceCreator extends java.lang.Object implements JsonbComponentInstanceCreator
CDI instance manager. Instances are created and stored per instance ofJsonBinding
. Calling close on JsonBinding, cleans up Jsonb CDI instances and in case of "dependant" scope its dependencies. CDI API dependency is optional, this class is never referenced / loaded if CDI API is not resolvable.
-
-
Field Summary
-
Fields inherited from interface org.eclipse.yasson.spi.JsonbComponentInstanceCreator
DEFAULT_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description BeanManagerInstanceCreator(java.lang.Object beanManager)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
<T> T
getOrCreateComponent(java.lang.Class<T> componentClass)
Creates an instance of the CDI managed bean.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.yasson.spi.JsonbComponentInstanceCreator
getPriority
-
-
-
-
Method Detail
-
getOrCreateComponent
public <T> T getOrCreateComponent(java.lang.Class<T> componentClass)
Creates an instance of the CDI managed bean. Calls CDI API to inject into the bean.- Specified by:
getOrCreateComponent
in interfaceJsonbComponentInstanceCreator
- Type Parameters:
T
- Jsonb component type- Parameters:
componentClass
- bean class to be instantiated.- Returns:
- New instance of bean class with injected content.
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-