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


Java AnnotatedMember.isAnnotationPresent方法代码示例

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


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

示例1: processProducer

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
/**
 * Collect all SqlSessionFactory producers annotated with SessionFactoryProvider.
 *
 * @param <T> the generic type
 * @param <X> the generic type
 * @param pp the pp
 */
@SuppressWarnings("UnusedDeclaration")
protected <T, X> void processProducer(@Observes final ProcessProducer<T, X> pp) {
  final AnnotatedMember<T> am = pp.getAnnotatedMember();
  final boolean isAnnotated = am.isAnnotationPresent(SessionFactoryProvider.class);
  final boolean isSqlSessionFactory = am.getBaseType().equals(SqlSessionFactory.class);
  final Object[] logData = { am.getJavaMember().getDeclaringClass().getSimpleName(), am.getJavaMember().getName() };
  if (isAnnotated && isSqlSessionFactory) {
    LOGGER.log(Level.INFO, "MyBatis CDI Module - SqlSessionFactory producer {0}.{1}", logData);
    this.sessionProducers.add(new BeanKey((Class<Type>) (Type) SqlSession.class, am.getAnnotations()));
  } else if (isAnnotated && !isSqlSessionFactory) {
    LOGGER.log(Level.SEVERE, "MyBatis CDI Module - Invalid return type (Must be SqlSessionFactory): {0}.{1}",
        logData);
    pp.addDefinitionError(new MybatisCdiConfigurationException(String
        .format("SessionFactoryProvider producers must return SqlSessionFactory (%s.%s)", logData[0], logData[1])));
  } else if (!isAnnotated && isSqlSessionFactory) {
    LOGGER.log(Level.WARNING,
        "MyBatis CDI Module - Ignored SqlSessionFactory producer because it is not annotated with @SessionFactoryProvider: {0}.{1}",
        logData);
  }
}
 
开发者ID:mybatis,项目名称:cdi,代码行数:28,代码来源:MybatisExtension.java

示例2: of

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
@Override
public String of(AnnotatedMember<?> member) {
    if (member.isAnnotationPresent(Metric.class)) {
        Metric metric = member.getAnnotation(Metric.class);
        String name = (metric.name().isEmpty()) ? member.getJavaMember().getName() : of(metric.name());
        return metric.absolute() | parameters.contains(MetricsParameter.useAbsoluteName) ? name : MetricRegistry.name(member.getJavaMember().getDeclaringClass(), name);
    } else {
        return parameters.contains(MetricsParameter.useAbsoluteName) ? member.getJavaMember().getName() : MetricRegistry.name(member.getJavaMember().getDeclaringClass(), member.getJavaMember().getName());
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:11,代码来源:SeMetricName.java

示例3: processCommandBusProducer

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
<T, X extends CommandBus> void processCommandBusProducer(
		@Observes final ProcessProducer<T, X> processProducer,
		final BeanManager beanManager) {

	AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();

	if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
		Producer<X> originalProducer = processProducer.getProducer();
		Producer<X> producer = new AutoConfiguringCommandBusProducer<>(originalProducer,
				annotatedMember, getAggregateRoots(), getCommandHandlers(), beanManager);
		processProducer.setProducer(producer);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:14,代码来源:AxonCdiExtension.java

示例4: processEventStoreProducer

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
<T, X extends EventStore> void processEventStoreProducer(
		@Observes final ProcessProducer<T, X> processProducer,
		final BeanManager beanManager) {
	AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
	if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
		Producer<X> originalProducer = processProducer.getProducer();
		Producer<X> producer = new AutoConfiguringEventStoreProducer<>(originalProducer,
				annotatedMember,
				getEventHandlers(),
				getSagas(), beanManager);
		processProducer.setProducer(producer);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:14,代码来源:AxonCdiExtension.java

示例5: processSnapshotterProducer

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
<T, X extends Snapshotter> void processSnapshotterProducer(
		@Observes final ProcessProducer<T, X> processProducer,
		final BeanManager beanManager) {
	Producer<X> originalProducer = processProducer.getProducer();
	AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
	if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
		Producer<X> producer = new AutoConfiguringAggregateSnapshotterProducer<>(originalProducer,
				annotatedMember, getAggregateRoots(), beanManager);
		processProducer.setProducer(producer);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:12,代码来源:AxonCdiExtension.java

示例6: processSagaRepositoryProducer

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
<T, X extends SagaRepository<?>> void processSagaRepositoryProducer(
		@Observes final ProcessProducer<T, X> processProducer,
		final BeanManager beanManager) {
	Producer<X> originalProducer = processProducer.getProducer();
	AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
	if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
		Producer<X> producer = new AutoConfiguringSagaRepositoryProducer<>(originalProducer,
				annotatedMember, beanManager);
		processProducer.setProducer(producer);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:12,代码来源:AxonCdiExtension.java

示例7: handleAnnotatedMember

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
private void handleAnnotatedMember(AnnotatedMember<?> member) {
	if (member.isAnnotationPresent(PersistenceContext.class)) {
		PersistenceContext persistenceContext = member.getAnnotation(PersistenceContext.class);
		injectedPersistenceContexts.put(persistenceContext.unitName(), member);
	}
	if (member.isAnnotationPresent(PersistenceUnit.class)) {
		PersistenceUnit persistenceUnit = member.getAnnotation(PersistenceUnit.class);
		injectedPersistenceUnits.add(persistenceUnit.unitName());
	}
}
 
开发者ID:spearal,项目名称:spearal-jpa2,代码行数:11,代码来源:SpearalExtension.java

示例8: produceMissingPersistenceUnits

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
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() });
		}
	}
}
 
开发者ID:spearal,项目名称:spearal-jpa2,代码行数:33,代码来源:SpearalExtension.java

示例9: of

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
@Override
public String of(AnnotatedMember<?> member) {
    if (member.isAnnotationPresent(Metric.class)) {
        Metric metric = member.getAnnotation(Metric.class);
        String name = (metric.name().isEmpty()) ? member.getJavaMember().getName() : of(metric.name());
        return metric.absolute() | parameters.contains(useAbsoluteName) ? name : MetricRegistry.name(member.getJavaMember().getDeclaringClass(), name);
    } else {
        return parameters.contains(useAbsoluteName) ? member.getJavaMember().getName() : MetricRegistry.name(member.getJavaMember().getDeclaringClass(), member.getJavaMember().getName());
    }
}
 
开发者ID:astefanutti,项目名称:metrics-cdi,代码行数:11,代码来源:SeMetricName.java

示例10: hasJavaEEAnnotations

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if at least one of the following Java EE annotations is present in the given member:
 * <ul>
 * <li> {@link EJB}
 * <li> {@link PersistenceContext}
 * <li> {@link Resource}
 * </ul>
 * Otherwise, it returns <code>false</code>.
 * @param <X> the type of the annotated member.
 * @param member the member whose annotations should be verified.
 * @return <code>true</code> if the member is at least annotated with one of the following annotations: {@link EJB}, {@link PersistenceContext} or {@link Resource}.
 */
private static <X> boolean hasJavaEEAnnotations(AnnotatedMember<? super X> member) {
     for(Class<? extends Annotation> javaEEannotation : JAVA_EE_ANNOTATIONS) {
         if (member.isAnnotationPresent(javaEEannotation)) {
             return true;
         }
     }
     return false;
}
 
开发者ID:NovaTecConsulting,项目名称:BeanTest,代码行数:21,代码来源:InjectionHelper.java

示例11: shouldInjectionAnnotationBeAddedToMember

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
/**
 * Returns <code>true</code> if the member is NOT annotated with {@link Inject} and is annotated with one of the following annotations:
 * <ul>
 * <li> {@link EJB}
 * <li> {@link PersistenceContext}
 * <li> {@link Resource}
 * </ul>
 * Otherwise, it returns <code>false</code>.
 *
 * @param <X>
 *            the type of the annotated member
 * @param member
 *            the annotated member whose annotations should be verified.
 * @return <code>true</code> if the member is NOT annotated with {@link Inject} and is annotated with {@link EJB},
 *         {@link PersistenceContext} or {@link Resource}
 */
public static <X>  boolean shouldInjectionAnnotationBeAddedToMember(AnnotatedMember<? super X> member) {
    return !member.isAnnotationPresent(Inject.class) && hasJavaEEAnnotations(member);
}
 
开发者ID:NovaTecConsulting,项目名称:BeanTest,代码行数:20,代码来源:InjectionHelper.java


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