本文整理汇总了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 );
}
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
示例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 ) );
}
示例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);
}
}
}
示例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;
}
示例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());
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}