All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.javagimmicks.collections.event.cdi.CDIBridgeBase Maven / Gradle / Ivy

There is a newer version: 0.99-alpha1
Show newest version
package net.sf.javagimmicks.collections.event.cdi;

import java.lang.annotation.Annotation;

import javax.enterprise.event.Event;
import javax.enterprise.inject.Any;

import net.sf.javagimmicks.cdi.AnnotationLiteralHelper;
import net.sf.javagimmicks.cdi.CDIContext;
import net.sf.javagimmicks.cdi.InjectionSpec;

abstract class CDIBrigeBase
{
   @SuppressWarnings("rawtypes")
   private static final InjectionSpec EVENT_INJECTION = InjectionSpec
         . build()
         .setClass(Event.class)
         .addTypeParameters(Object.class)
         .addAnnotations(AnnotationLiteralHelper.annotation(Any.class))
         .getInjection();

   @SuppressWarnings("unchecked")
   static  Event buildEvent(final Class eventType, final Annotation... annotations)
   {
      return EVENT_INJECTION.getInstance(CDIContext.getBeanManager()).select(eventType, annotations);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy