Examples of Annotated


Examples of javax.enterprise.inject.spi.Annotated

*/
class TypedMessageBundleAndLoggerProducers implements Serializable {
    @Produces
    @TypedMessageLogger
    Object produceTypedLogger(InjectionPoint injectionPoint) {
        Annotated annotated = injectionPoint.getAnnotated();
        if (annotated.isAnnotationPresent(Category.class)) {
            if (annotated.isAnnotationPresent(Locale.class)) {
                return getMessageLogger(getInjectionPointRawType(injectionPoint), annotated.getAnnotation(Category.class)
                        .value(), toLocale(annotated.getAnnotation(Locale.class).value()));
            } else {
                return getMessageLogger(getInjectionPointRawType(injectionPoint), annotated.getAnnotation(Category.class)
                        .value());
            }
        } else if (annotated.isAnnotationPresent(TypedCategory.class)) {
            if (annotated.isAnnotationPresent(Locale.class)) {
                return getMessageLogger(getInjectionPointRawType(injectionPoint), annotated.getAnnotation(TypedCategory.class)
                        .value().getName(), toLocale(annotated.getAnnotation(Locale.class).value()));
            } else {
                return getMessageLogger(getInjectionPointRawType(injectionPoint), annotated.getAnnotation(TypedCategory.class)
                        .value().getName());
            }
        } else {
            throw new IllegalStateException("Must specify @Category or @TypedCategory for typed loggers at [" + injectionPoint
                    + "]");
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

    }

    @Produces
    @TypedMessageBundle
    Object produceTypedMessageBundle(InjectionPoint injectionPoint) {
        Annotated annotated = injectionPoint.getAnnotated();
        if (annotated.isAnnotationPresent(Locale.class)) {
            return getBundle(getRawType(injectionPoint.getType()), toLocale(annotated.getAnnotation(Locale.class).value()));
        } else {
            return getBundle(getRawType(injectionPoint.getType()));
        }
    }
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

        }
    }

    <X> void detectInjections(@Observes ProcessInjectionTarget<X> event) {
        for (InjectionPoint ip : event.getInjectionTarget().getInjectionPoints()) {
            Annotated annotated = ip.getAnnotated();
            for (Class<? extends Annotation> paramAnnotationType : producerBlueprints.keySet()) {
                if (annotated.isAnnotationPresent(paramAnnotationType)) {
                    Collection<Annotation> allowed = Arrays.asList(DefaultLiteral.INSTANCE, AnyLiteral.INSTANCE,
                            annotated.getAnnotation(paramAnnotationType));
                    boolean error = false;
                    for (Annotation q : ip.getQualifiers()) {
                        if (!allowed.contains(q)) {
                            event.addDefinitionError(new IllegalArgumentException(messages.additionalQualifiersNotPermitted(
                                    paramAnnotationType.getSimpleName(), ip)));
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

    processBeanImpl(event);
  }
 
  private <T> void processBeanImpl(ProcessBean<T> event)
  {
    Annotated annotated = event.getAnnotated();
    Bean<T> bean = event.getBean();

    if (annotated == null) {
      return;
    }

    if (! (bean instanceof EjbGeneratedBean)
        && (annotated.isAnnotationPresent(Stateful.class)
            || annotated.isAnnotationPresent(Stateless.class)
            || annotated.isAnnotationPresent(Singleton.class)
            || annotated.isAnnotationPresent(MessageDriven.class)
            || annotated.isAnnotationPresent(JmsMessageListener.class))) {
      EjbManager ejbContainer = EjbManager.create();

      if (bean instanceof ManagedBeanImpl<?>) {
        // XXX: shouldn't reach processBeanImpl
        if (true)
          throw new IllegalStateException(String.valueOf(annotated));
       
        ManagedBeanImpl<T> mBean = (ManagedBeanImpl<T>) bean;
        AnnotatedType<T> annType = mBean.getAnnotatedType();
       
        ejbContainer.createBean(annType, mBean.getInjectionTarget());
       
        if (event instanceof ProcessBeanImpl<?>)
          ((ProcessBeanImpl<?>) event).veto();
      }
    }
   
    if (annotated.isAnnotationPresent(Jndi.class)) {
      Jndi jndi = annotated.getAnnotation(Jndi.class);
      String jndiName = jndi.value();

      if ("".equals(jndiName)) {
        jndiName = bean.getBeanClass().getSimpleName();
      }
     
      JndiBeanProxy<T> proxy = new JndiBeanProxy<T>(_cdiManager, bean);
     
      if (log.isLoggable(Level.FINE))
        log.fine("bind to JNDI '" + jndiName + "' for " + bean);
                
      try {
        com.caucho.naming.Jndi.bindDeepShort(jndiName, proxy);
      } catch (Exception e) {
        log.log(Level.FINE, e.toString(), e);
      }
    }
   
    if (annotated.isAnnotationPresent(ManagedBean.class)){
      registerManagedBean(annotated, bean);
    }

    if (annotated.isAnnotationPresent(MBean.class)) {
      MBean mbean = annotated.getAnnotation(MBean.class);
     
      String mbeanName = mbean.value();
      if ("".equals(mbeanName))
        mbeanName = "type=" + bean.getBeanClass().getSimpleName();
     
      AnnotatedType<?> annType = (AnnotatedType<?>) annotated;
     
      try {
        Jmx.registerContext(new BeanMBean(_cdiManager, bean, annType), mbeanName);
      } catch (Exception e) {
        log.log(Level.FINE, e.toString(), e);
      }
    }

    if (annotated.isAnnotationPresent(BamService.class)) {
      BamService service = annotated.getAnnotation(BamService.class);

      HempBroker broker = HempBroker.getCurrent();
      broker.addStartupActor(event.getBean(), service.name(),
                             service.threadMax());
    }

    if (annotated.isAnnotationPresent(AdminService.class)) {
      AdminService service = annotated.getAnnotation(AdminService.class);

      Server server = Server.getCurrent();

      if (server == null) {
        throw new ConfigException(L
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

  @LazyExtension
  public void processBean(@Observes ProcessBeanImpl<?> event)
  {
    try {
      Annotated annotated = event.getAnnotated();
      Bean<?> bean = event.getBean();

      if (annotated == null
          || annotated.getAnnotations() == null
          || annotated.isAnnotationPresent(Enhanced.class)) {
        return;
      }

      for (Annotation ann : annotated.getAnnotations()) {
        Class<?> annType = ann.annotationType();
       
        if (annType.equals(WebServlet.class)) {
          WebServlet webServlet = (WebServlet) ann;
     
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

        public Object redefineParameterValue(ParameterValue value) {
            Object result = value.getDefaultValue(creationalContext);

            InjectionPoint injectionPoint = value.getInjectionPoint();
            if (injectionPoint != null) {
                Annotated securingParameterAnnotatedType = injectionPoint.getAnnotated();
                Set<Annotation> securingParameterAnnotations = securingParameterAnnotatedType.getAnnotations();

                Set<Annotation> requiredBindingAnnotations = new HashSet<Annotation>();
                for (Annotation annotation : securingParameterAnnotations) {
                    if (annotation.annotationType().isAnnotationPresent(SecurityParameterBinding.class)) {
                        requiredBindingAnnotations.add(annotation);
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

     * Lets detect all producer methods creating instances of {@link RouteBuilder} which are annotated with {@link org
     * .apache.camel.cdi.ContextName}
     * so they can be auto-registered
     */
    public void detectProducerRoutes(@Observes ProcessProducerMethod<?, ?> event) {
        Annotated annotated = event.getAnnotated();
        ContextName annotation = annotated.getAnnotation(ContextName.class);
        Class<?> returnType = event.getAnnotatedProducerMethod().getJavaMember().getReturnType();
        if (isRoutesBean(returnType)) {
            addRouteBuilderBean(event.getBean(), annotation);
        }
    }
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

            {
                return result;
            }
            else
            {
                Annotated securingParameterAnnotatedType = injectionPoint.getAnnotated();
                Set<Annotation> securingParameterAnnotations = securingParameterAnnotatedType.getAnnotations();

                Set<Annotation> requiredBindingAnnotations = new HashSet<Annotation>();
                for (Annotation annotation : securingParameterAnnotations)
                {
                    if (annotation.annotationType().isAnnotationPresent(SecurityParameterBinding.class))
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

      }
   }

   public void processRemoteInjectionPointConsumer(@Observes ProcessInjectionPoint<?, ?> event, BeanManager manager)
   {
      Annotated annotated = event.getInjectionPoint().getAnnotated();

      Class<?> injectionPointDeclaringType = Types.toClass(event.getInjectionPoint().getMember().getDeclaringClass());
      Class<?> injectionBeanValueType = Types.toClass(annotated.getBaseType());

      Class<?> injectionPointConsumingType = null;
      if (event.getInjectionPoint().getBean() != null)
         injectionPointConsumingType = event.getInjectionPoint().getBean().getBeanClass();
      else
View Full Code Here

Examples of javax.enterprise.inject.spi.Annotated

   {
      // needs to happen in the addon that is requesting the service
      for (final Entry<InjectionPoint, Class<?>> entry : requestedServices.entrySet())
      {
         final InjectionPoint injectionPoint = entry.getKey();
         final Annotated annotated = injectionPoint.getAnnotated();
         final Member member = injectionPoint.getMember();

         Class<?> beanClass = entry.getValue();
         Set<Type> typeClosure = annotated.getTypeClosure();
         Set<Type> beanTypeClosure = new LinkedHashSet<Type>();
         for (Type type : typeClosure)
         {
            beanTypeClosure.add(reifyWildcardsToObjects(type));
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.