Exemple #1
0
 protected void initEnhancedSubclass() {
   final ClassTransformer transformer = beanManager.getServices().get(ClassTransformer.class);
   enhancedSubclass = transformer.loadClass(createEnhancedSubclass());
   constructorForEnhancedSubclass =
       WeldConstructorImpl.of(
           enhancedSubclass.getDeclaredWeldConstructor(getConstructor().getSignature()),
           enhancedSubclass,
           transformer);
 }
  public ExtensionBeanDeployer deployBeans() {
    ClassTransformer classTransformer =
        Container.instance().deploymentServices().get(ClassTransformer.class);
    for (Extension extension : extensions) {
      @SuppressWarnings("unchecked")
      WeldClass<Extension> clazz =
          (WeldClass<Extension>) classTransformer.loadClass(extension.getClass());

      // Locate the BeanDeployment for this extension
      BeanDeployment beanDeployment =
          DeploymentStructures.getOrCreateBeanDeployment(
              deployment, beanManager, beanDeployments, clazz.getJavaClass());

      ExtensionBean bean = new ExtensionBean(beanDeployment.getBeanManager(), clazz, extension);
      Set<ObserverMethodImpl<?, ?>> observerMethods = new HashSet<ObserverMethodImpl<?, ?>>();
      createObserverMethods(bean, beanDeployment.getBeanManager(), clazz, observerMethods);
      beanDeployment.getBeanManager().addBean(bean);
      for (ObserverMethodImpl<?, ?> observerMethod : observerMethods) {
        observerMethod.initialize();
        beanDeployment.getBeanManager().addObserver(observerMethod);
      }
    }
    return this;
  }