Package com.caucho.config.event

Examples of com.caucho.config.event.EventManager


   * Introspects the methods for any @Produces
   */
  private void introspectObservers(AnnotatedType<X> beanType,
                                   AnnotatedType<X> extAnnType)
  {
    EventManager eventManager = _context.getModuleInjectManager().getEventManager();

    // ioc/0b26
    for (AnnotatedMethod<? super X> beanMethod : beanType.getMethods()) {
      /*
      if (! beanMethod.getJavaMember().getDeclaringClass().equals(beanType.getJavaClass())
          && ! beanType.isAnnotationPresent(Specializes.class)) {
        continue;
      }
      */
     
      AnnotatedMethod<? super X> apiMethod
        = AnnotatedTypeUtil.findMethod(extAnnType, beanMethod);
     
      boolean isBeanMethod = false;

      if (apiMethod == null) {
        apiMethod = beanMethod;
        isBeanMethod = true;
      }
      else if (apiMethod instanceof AnnotatedMethodImpl<?>) {
        // ioc/0b0h
        AnnotatedMethodImpl<? super X> apiMethodImpl
          = (AnnotatedMethodImpl<? super X>) apiMethod;

        apiMethodImpl.addAnnotations(beanMethod.getAnnotations());
       
        for (int i = 0; i < apiMethod.getParameters().size(); i++) {
          AnnotatedParameterImpl<?> paramImpl
            = (AnnotatedParameterImpl<?>) apiMethod.getParameters().get(i);
          AnnotatedParameter<?> beanParam = beanMethod.getParameters().get(i);
         
          paramImpl.addAnnotations(beanParam.getAnnotations());
        }
      }
       
     
      int param = EventManager.findObserverAnnotation(apiMethod);
     
      if (param >= 0) {
        // ioc/0b0i - TCK
       
        if (! isBeanMethod) {
        }
        else if (apiMethod.isStatic()) {
        }
        else if (_types.contains(beanType.getJavaClass())) {
          // ioc/0b26
        }
        else {
          throw new ConfigException(L.l("{0}.{1} is an invalid @Observes method because @Observes must be in the @Local API.",
                                        beanMethod.getDeclaringType().getJavaClass().getSimpleName(),
                                        beanMethod.getJavaMember().getName()));
        }
         
        eventManager.addObserver(this, apiMethod);
      }
    }
  }
View Full Code Here


  /**
   * Introspects the methods for any @Observes
   */
  void introspectObservers()
  {
    EventManager eventManager = getBeanManager().getEventManager();
   
    AnnotatedType<X> annType = getAnnotatedType();

    // ioc/0b25
    /*
    if (! getBeanManager().isIntrospectObservers(annType))
      return;
      */
    for (AnnotatedMethod<? super X> beanMethod : annType.getMethods()) {
      int param = EventManager.findObserverAnnotation(beanMethod);
     
      if (param < 0)
        continue;
     
      // ioc/0b25
      /*
      Class<?> declClass = beanMethod.getJavaMember().getDeclaringClass();
      if (declClass != annType.getJavaClass()
          && declClass.isAssignableFrom(annType.getJavaClass())
          && ! annType.isAnnotationPresent(Specializes.class)) {
        continue;
      }
      */
     
      eventManager.addObserver(this, beanMethod);
    }
  }
View Full Code Here

TOP

Related Classes of com.caucho.config.event.EventManager

Copyright © 2018 www.massapicom. 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.