当前位置: 首页>>代码示例>>Java>>正文


Java AnnotatedType.getJavaClass方法代码示例

本文整理汇总了Java中javax.enterprise.inject.spi.AnnotatedType.getJavaClass方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotatedType.getJavaClass方法的具体用法?Java AnnotatedType.getJavaClass怎么用?Java AnnotatedType.getJavaClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.enterprise.inject.spi.AnnotatedType的用法示例。


在下文中一共展示了AnnotatedType.getJavaClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findJobs

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
<T> void findJobs( @Observes @WithAnnotations({Cron.class}) ProcessAnnotatedType<T> pat, BeanManager beanManager )
{
    // Ensure we are named otherwise job won't fire as we can't locate it
    AnnotatedType<?> type = pat.getAnnotatedType();
    Class<?> clazz = type.getJavaClass();
    CDIUtils.addTypeAnnotation( pat, Named.class, () -> new NamedImpl( "Schedule_" + (id++) ) );

    if( type.isAnnotationPresent( Cron.class ) ) {
        if( Job.class.isAssignableFrom( clazz ) ) {
            jobClasses.add( clazz );
        }
        else {
            throw new UnsupportedOperationException( "@Cron on type must implement Job" );
        }
    }
    else {
        for( AnnotatedMethod<?> meth: type.getMethods() ) {
            if( meth.isAnnotationPresent( Cron.class ) ) {
                jobClasses.add( clazz );
            }
        }
    }
}
 
开发者ID:peter-mount,项目名称:opendata-common,代码行数:24,代码来源:SchedulerExtension.java

示例2: afterDeploymentValidation

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
/**
 * Instantiates <em>unmanaged instances</em> of HealthCheckProcedure and
 * handle manually their CDI creation lifecycle.
 * Add them to the {@link Monitor}.
 */
private void afterDeploymentValidation(@Observes final AfterDeploymentValidation abd, BeanManager beanManager) {
    try {
        for (AnnotatedType delegate : delegates) {
            Unmanaged<HealthCheck> unmanagedHealthCheck = new Unmanaged<HealthCheck>(beanManager, delegate.getJavaClass());
            Unmanaged.UnmanagedInstance<HealthCheck> healthCheckInstance = unmanagedHealthCheck.newInstance();
            HealthCheck healthCheck =  healthCheckInstance.produce().inject().postConstruct().get();
            healthChecks.add(healthCheck);
            healthCheckInstances.add(healthCheckInstance);

            monitor.registerHealthBean(healthCheck);

            log.info(">> Added health bean impl " + healthCheck);
        }

        // we don't need the references anymore
        delegates.clear();

    } catch (Exception e) {
        throw new RuntimeException("Failed to register health bean", e);
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:27,代码来源:HealthExtension.java

示例3: observeResources

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
/**
 * Discover all classes that implements HealthCheckProcedure
 */
public void observeResources(@Observes @WithAnnotations({Health.class})  ProcessAnnotatedType<? extends HealthCheck> event) {
   AnnotatedType<? extends HealthCheck> annotatedType = event.getAnnotatedType();
   Class<? extends HealthCheck> javaClass = annotatedType.getJavaClass();
   MicroProfileHealthLogger.ROOT_LOGGER.debugf("Discovered health check procedure %s", javaClass);
   delegates.add(annotatedType);
}
 
开发者ID:jmesnil,项目名称:wildfly-microprofile-health,代码行数:10,代码来源:CDIExtension.java

示例4: afterDeploymentValidation

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
/**
 * Instantiates <em>unmanaged instances</em> of HealthCheckProcedure and
 * handle manually their CDI creation lifecycle.
 * Add them to the {@link HealthMonitor}.
 */
private void afterDeploymentValidation(@Observes final AfterDeploymentValidation avd, BeanManager bm) {
   for (AnnotatedType delegate : delegates) {
      try {
         Unmanaged<HealthCheck> unmanagedHealthCheck = new Unmanaged<HealthCheck>(bm, delegate.getJavaClass());
         UnmanagedInstance<HealthCheck> healthCheckInstance = unmanagedHealthCheck.newInstance();
         HealthCheck healthCheck =  healthCheckInstance.produce().inject().postConstruct().get();
         healthChecks.add(healthCheck);
         healthCheckInstances.add(healthCheckInstance);
         healthMonitor.addHealthCheck(healthCheck);
      } catch (Exception e) {
         throw new RuntimeException("Failed to register health bean", e);
      }
   }
}
 
开发者ID:jmesnil,项目名称:wildfly-microprofile-health,代码行数:20,代码来源:CDIExtension.java

示例5: forEachMethod

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
/**
 * For each method in a type that has a specific annotation pass the class and method to a consumer
 *
 * @param <T>
 * @param pat
 * @param annotationType
 * @param c
 */
public static <T> void forEachMethod( ProcessAnnotatedType<T> pat, Class<? extends Annotation> annotationType,
                                      BiConsumer<Class<?>, ? super AnnotatedMethod<? extends Object>> c )
{
    AnnotatedType<?> type = pat.getAnnotatedType();
    Class<?> clazz = type.getJavaClass();
    type.getMethods()
            .stream().
            filter( meth -> meth.isAnnotationPresent( annotationType ) ).
            forEach( m -> c.accept( clazz, m ) );
}
 
开发者ID:peter-mount,项目名称:opendata-common,代码行数:19,代码来源:CDIUtils.java

示例6: observeResources

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
public <T> void observeResources(@Observes @WithAnnotations({Health.class}) ProcessAnnotatedType<T> event) {

        AnnotatedType<T> annotatedType = event.getAnnotatedType();
        Class<T> javaClass = annotatedType.getJavaClass();
        for (Class<?> intf : javaClass.getInterfaces()) {
            if (intf.getName().equals(HealthCheck.class.getName())) {
                log.info(">> Discovered health check procedure " + javaClass);
                delegates.add(annotatedType);
            }
        }
    }
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:12,代码来源:HealthExtension.java

示例7: processAnnotatedType

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
<X> void processAnnotatedType(@Observes final javax.enterprise.inject.spi.ProcessAnnotatedType<X> pat,
                              BeanManager beanManager) {
    if (isHttpRequestSupportAvailable) {

        final AnnotatedType<X> annotatedType = pat.getAnnotatedType();
        final Class<X> javaClass = annotatedType.getJavaClass();

        if (javaClass != null && javaClass.getName().equals(HttpRequestProducer.class.getName())) {
            pat.veto();
        }
    }
    return;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:14,代码来源:HttpServletRequestProducerExtension.java

示例8: annotates

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public void annotates(@Observes ProcessAnnotatedType pat) {
	AnnotatedType annotatedType = pat.getAnnotatedType();
	Class type = annotatedType.getJavaClass();
	
	// verify if it has Controller in its name
	if(type.getSimpleName().endsWith("Controller")) {
		pat.setAnnotatedType(new AnnotatedTypeControllerWrapper(annotatedType));
		System.out.println("[CDI Extension] Controller found: " + type.getSimpleName());
	}
}
 
开发者ID:wesleyegberto,项目名称:javaee_projects,代码行数:12,代码来源:ControllerAnnotator.java

示例9: processAnnotatedTypes

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
public <X> void processAnnotatedTypes(@Observes ProcessAnnotatedType<X> pat) {
    AnnotatedType<X> type = pat.getAnnotatedType();
    final Class<X> javaClass = type.getJavaClass();
    if (javaClass.isAnnotationPresent(ActivatableTestImplementation.class)) {
        new ActivatableAlternativeBuilder<X>(pat).invoke();
    } else if (ReflectionsUtils.isTestClass(javaClass)) {
        AnnotationUtils.addClassAnnotation(pat, new AnnotationLiteral<TestSuiteScoped>() {
        });
    } else if (ReflectionsUtils.shouldProxyCdiType(javaClass)) {
        AnnotationUtils.addClassAnnotation(pat, new AnnotationLiteral<Replaceable>() {
        });
    }
    updateDecoratedTypes(pat);
}
 
开发者ID:guhilling,项目名称:cdi-test,代码行数:15,代码来源:TestScopeExtension.java

示例10: eventHandler

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
public static HandlerInfo eventHandler(final BeanManager bm, final AnnotatedType<?> annotated) {
	return new HandlerInfo(annotated.getJavaClass(), CdiUtils.qualifiers(bm, annotated), true);
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:4,代码来源:HandlerInfo.java

示例11: commandHandler

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
public static HandlerInfo commandHandler(final BeanManager bm, final AnnotatedType<?> annotated) {
	return new HandlerInfo(annotated.getJavaClass(), CdiUtils.qualifiers(bm, annotated), false);
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:4,代码来源:HandlerInfo.java

示例12: of

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
public static SagaInfo of(final BeanManager bm, AnnotatedType<?> annotated) {
	Map<QualifierType, Set<Annotation>> qualifiers = extractQualifiers(bm, annotated);
	return new SagaInfo(annotated.getJavaClass(), qualifiers);
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:5,代码来源:SagaInfo.java

示例13: of

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
public static AggregateRootInfo of(final BeanManager bm, final AnnotatedType<?> annotated) {
	Map<QualifierType, Set<Annotation>> qualifiers = extractQualifiers(bm, annotated);
	return new AggregateRootInfo(annotated.getJavaClass(), qualifiers);
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:5,代码来源:AggregateRootInfo.java

示例14: isVetoed

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
private <X> boolean isVetoed(AnnotatedType<X> annotated)
{
    Class<X> javaClass = annotated.getJavaClass();
    return javaClass.equals(AbstractEntityRepository.class) ||
           javaClass.equals(AbstractFullEntityRepository.class);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:7,代码来源:RepositoryExtension.java

示例15: createDefaultBeanName

import javax.enterprise.inject.spi.AnnotatedType; //导入方法依赖的package包/类
private String createDefaultBeanName(AnnotatedType<T> type)
{
    Class<T> javaClass = type.getJavaClass();
    return Introspector.decapitalize(javaClass.getSimpleName());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:6,代码来源:BeanBuilder.java


注:本文中的javax.enterprise.inject.spi.AnnotatedType.getJavaClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。