Java 类javax.enterprise.inject.spi.ProcessManagedBean 实例源码

项目:aries-jpa    文件:TransactionExtension.java   
<X> void processBean(@Observes ProcessManagedBean<X> event) {
    AnnotatedType<X> annotatedType = event.getAnnotatedBeanClass();
    Transactional classTx = annotatedType.getAnnotation(Transactional.class);
    for (AnnotatedMethod<? super X> am : annotatedType.getMethods()) {
        Transactional methodTx = am.getAnnotation(Transactional.class);
        if (classTx != null || methodTx != null) {
            Method method = am.getJavaMember();
            Transactional attrType = mergeTransactionAttributes(classTx, methodTx);
            transactionAttributes.put(method, attrType);
        }
    }
}
项目:wildfly-swarm    文件:HystrixExtension.java   
/**
 * Observe all enabled managed beans and identify/validate FT operations. This allows us to:
 * <ul>
 * <li>Skip validation of types which are not recognized as beans (e.g. are vetoed)</li>
 * <li>Take the final values of AnnotatedTypes</li>
 * <li>Support annotations added via portable extensions</li>
 * </ul>
 *
 * @param event
 */
void collectFaultToleranceOperations(@Observes ProcessManagedBean<?> event) {
    AnnotatedType<?> annotatedType = event.getAnnotatedBeanClass();
    for (AnnotatedMethod<?> annotatedMethod : annotatedType.getMethods()) {
        FaultToleranceOperation operation = FaultToleranceOperation.of(annotatedMethod);
        if (operation.isLegitimate() && operation.validate()) {
            LOGGER.debugf("Found %s", operation);
            faultToleranceOperations.put(annotatedMethod.getJavaMember().toGenericString(), operation);
        }
    }
}
项目:transaction-cdi    文件:TransactionExtension.java   
/**
 * Observes {@link ProcessManagedBean} event.
 *
 * @param event {@link ProcessManagedBean} event.
 */
<X> void processBean(
    @Observes ProcessManagedBean<X> event)
{
    boolean sessionBean = event instanceof ProcessSessionBean<?>;
    AnnotatedType<X> annotatedType = event.getAnnotatedBeanClass();
    boolean hasClassInterceptor = annotatedType
        .isAnnotationPresent(Transactional.class);
    if (hasClassInterceptor && sessionBean)
    {
        event.addDefinitionError(new RuntimeException(
            "@Transactional is forbidden for session bean "
                + event.getBean()));
    }
    else
    {
        TransactionAttribute classAttr = annotatedType
            .getAnnotation(TransactionAttribute.class);
        for (AnnotatedMethod<? super X> am : annotatedType.getMethods())
        {
            boolean hasMethodInterceptor = am
                .isAnnotationPresent(Transactional.class);
            if (hasMethodInterceptor && sessionBean)
            {
                event.addDefinitionError(new RuntimeException(
                    "@Transactional is forbidden for session bean method "
                    + am));
            }
            else if (hasClassInterceptor || hasMethodInterceptor)
            {
                TransactionAttribute attr = am
                    .getAnnotation(TransactionAttribute.class);
                Method method = am.getJavaMember();
                TransactionAttributeType attrType =
                    mergeTransactionAttributes(classAttr, attr);
                transactionAttributes.put(method, attrType);
            }
        }
    }
}
项目:deltaspike    文件:MBeanExtension.java   
protected void processBean(@Observes final ProcessManagedBean<?> bean, final BeanManager bm) throws Exception
{
    if (!isActivated)
    {
        return;
    }

    MBean mBeanAnnotation = bean.getAnnotated().getAnnotation(MBean.class);
    if (mBeanAnnotation != null)
    {
        registerObject(bean, mBeanAnnotation, bm);
    }
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:ObserverExtension.java   
<T> void processManagedBean(@Observes ProcessManagedBean<T> pmb) {
    logger.info("finished the scanning process");
    processManagedBean++;
}