- java.lang.Object
-
- org.omnifaces.cdi.param.ParamExtension
-
- All Implemented Interfaces:
Extension
public class ParamExtension extends Object implements Extension
CDI extension that works around the fact that CDI insists on doing absolutely guaranteed type safe injections. While generally applaudable this unfortunately impedes writing true generic producers that dynamically do conversion based on the target type.This extension collects the target types of each injection point qualified with the
@
Param
annotation and dynamically registers Beans that effectively represents producers for each type.Since OmniFaces 3.6, this extension also scans for
@
Param
without@
Inject
and manually takes care of them while creating the bean.- Since:
- 2.0
- Author:
- Arjan Tijms
-
-
Constructor Summary
Constructors Constructor Description ParamExtension()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
collectParams(ProcessInjectionTarget<T> event)
Collect fields annotated withParam
.void
processParamsWithInject(AfterBeanDiscovery event)
static <T> void
processParamsWithoutInject(ProcessInjectionTarget<T> event, Set<AnnotatedField<?>> paramsWithoutInject)
-
-
-
Method Detail
-
collectParams
public <T> void collectParams(@Observes ProcessInjectionTarget<T> event)
Collect fields annotated withParam
.- Type Parameters:
T
- The generic injection target type.- Parameters:
event
- The process injection target event.
-
processParamsWithInject
public void processParamsWithInject(@Observes AfterBeanDiscovery event)
- Parameters:
event
- The after bean discovery event.
-
processParamsWithoutInject
public static <T> void processParamsWithoutInject(ProcessInjectionTarget<T> event, Set<AnnotatedField<?>> paramsWithoutInject)
-
-