Class BeanManagerInstanceCreator
java.lang.Object
org.eclipse.yasson.internal.components.BeanManagerInstanceCreator
- All Implemented Interfaces:
Closeable, AutoCloseable, JsonbComponentInstanceCreator
CDI instance manager.
Instances are created and stored per instance of
JsonBinding.
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classHolder for bean instance and its injection target. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final jakarta.enterprise.inject.spi.BeanManagerprivate final ConcurrentMap<Class<?>, BeanManagerInstanceCreator.CDIManagedBean<?>> Fields inherited from interface JsonbComponentInstanceCreator
DEFAULT_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate <T> voidvoidclose()<T> TgetOrCreateComponent(Class<T> componentClass) Creates an instance of the CDI managed bean.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface JsonbComponentInstanceCreator
getPriority
-
Field Details
-
beanManager
private final jakarta.enterprise.inject.spi.BeanManager beanManager -
injectionTargets
private final ConcurrentMap<Class<?>, BeanManagerInstanceCreator.CDIManagedBean<?>> injectionTargets
-
-
Constructor Details
-
BeanManagerInstanceCreator
Creates a new instance.- Parameters:
beanManager- Bean manager.
-
-
Method Details
-
getOrCreateComponent
Creates an instance of the CDI managed bean. Calls CDI API to inject into the bean.- Specified by:
getOrCreateComponentin interfaceJsonbComponentInstanceCreator- Type Parameters:
T- Jsonb component type- Parameters:
componentClass- bean class to be instantiated.- Returns:
- New instance of bean class with injected content.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
cleanupBean
-