protected <T> void processBeanRegistration(
      BeanRegistration registration, GlobalEnablementBuilder globalEnablementBuilder) {
    Bean<?> bean = registration.getBean();
    BeanManagerImpl beanManager = registration.getBeanManager();
    if (beanManager == null) {
      // Get the bean manager for beans added via ABD#addBean()
      beanManager = getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager();
    } else {
      // Also validate the bean produced by a builder
      ExternalBeanAttributesFactory.validateBeanAttributes(bean, getBeanManager());
      validateBean(bean);
    }

    // Custom beans (alternatives, interceptors, decorators) may also implement
    // javax.enterprise.inject.spi.Prioritized
    Integer priority = (bean instanceof Prioritized) ? ((Prioritized) bean).getPriority() : null;

    if (bean instanceof Interceptor<?>) {
      beanManager.addInterceptor((Interceptor<?>) bean);
      if (priority != null) {
        globalEnablementBuilder.addInterceptor(bean.getBeanClass(), priority);
      }
    } else if (bean instanceof Decorator<?>) {
      beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager));
      if (priority != null) {
        globalEnablementBuilder.addDecorator(bean.getBeanClass(), priority);
      }
    } else {
      beanManager.addBean(bean);
      if (priority != null && bean.isAlternative()) {
        globalEnablementBuilder.addAlternative(bean.getBeanClass(), priority);
      }
    }
    containerLifecycleEvents.fireProcessBean(beanManager, bean, registration.getExtension());
  }
 @Override
 public void addBean(Bean<?> bean) {
   checkWithinObserverNotification();
   Preconditions.checkArgumentNotNull(bean, "bean");
   ExternalBeanAttributesFactory.validateBeanAttributes(bean, getBeanManager());
   validateBean(bean);
   additionalBeans.add(BeanRegistration.of(bean, getReceiver()));
   BootstrapLogger.LOG.addBeanCalled(getReceiver(), bean);
 }