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

项目:spearal-jpa2    文件:SpearalExtension.java   
public void produceMissingPersistenceUnits(@Observes AfterTypeDiscovery event, BeanManager beanManager) {
    for (String unitName : injectedPersistenceUnits)
        injectedPersistenceContexts.remove(unitName);

    for (AnnotatedMember<?> member : injectedPersistenceContexts.values()) {

        if (!member.isAnnotationPresent(SpearalEnabled.class))
            continue;

        PersistenceContext persistenceContext = member.getAnnotation(PersistenceContext.class);

        try {
            final Set<Annotation> annotations = new HashSet<Annotation>(member.getAnnotations());
            Iterator<Annotation> ia = annotations.iterator();
            while (ia.hasNext()) {
                Annotation a = ia.next();
                if (a.annotationType().equals(PersistenceContext.class))
                    ia.remove();
            }
            PersistenceUnit persistenceUnit = new PersistenceUnitAnnotation(persistenceContext.name(), persistenceContext.unitName());

            annotations.add(persistenceUnit);

            final AnnotatedType<PersistenceUnitProducer> annotatedPU = new AnnotatedPersistenceUnitProducerType(annotations);

            event.addAnnotatedType(annotatedPU, "org.spearal.jpa2.PersistenceUnit." + persistenceContext.unitName());
        }
        catch (Exception e) {
            log.logp(Level.WARNING, SpearalExtension.class.getName(), "afterTypeDiscovery", "Could not setup PersistenceUnit integration {0}", new Object[] { persistenceContext.unitName() });
        }
    }
}
项目:javaee-nosql    文件:MongoExtension.java   
/**
 * Warns user if there's none onr more than one {@link MongoClientDefinition} in the application
 */
void checkMongoClientUniqueness(@Observes AfterTypeDiscovery atd) {
    if (mongoDef == null) {
        log.warning("No MongoDB data sources found, mongo CDI extension will do nothing");
    } else if (moreThanOne) {
        log.log(Level.WARNING, "You defined more than one MongoDB data source. Only the one with name {0} will be "
                + "created", mongoDef
                .name());
    }

}
项目:Mastering-Java-EE-Development-with-WildFly    文件:ObserverExtension.java   
void afterTypeDiscovery(@Observes AfterTypeDiscovery atd) {
    logger.info("finished the scanning process");
    afterTypeDiscovery++;
}
项目:Java-EE    文件:LifeCycleLogger.java   
void logLifecycleEvent(@Observes AfterTypeDiscovery event) {
    LOGGER.info("AfterTypeDiscovery: alternatives=" + event.getAlternatives() + ", interceptors="
            + event.getInterceptors() + ", decorators=" + event.getDecorators());
}