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


Java AnnotatedMember.getAnnotation方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: onProcessProducer

import javax.enterprise.inject.spi.AnnotatedMember; //导入方法依赖的package包/类
public <X, T> void onProcessProducer(@Observes ProcessProducer<X, T> processProducer, BeanManager beanManager)
{
    if (!isActivated)
    {
        return;
    }

    for (MockFilter mockFilter : mockFilters)
    {
        if (!mockFilter.isMockedImplementationSupported(beanManager, processProducer.getAnnotatedMember()))
        {
            return;
        }
    }

    final Producer<T> originalProducer = processProducer.getProducer();
    AnnotatedMember<X> annotatedMember = processProducer.getAnnotatedMember();
    List<Annotation> qualifiers = new ArrayList<Annotation>();
    for (Annotation annotation : annotatedMember.getAnnotations())
    {
        if (beanManager.isQualifier(annotation.annotationType()))
        {
            qualifiers.add(annotation);
        }
    }

    Typed typed = annotatedMember.getAnnotation(Typed.class);

    List<Type> foundTypes = new ArrayList<Type>();
    if (typed != null)
    {
        Collections.addAll(foundTypes, typed.value());
    }
    else if (annotatedMember.getBaseType() instanceof Class)
    {
        foundTypes.addAll(extractTypes((Class)annotatedMember.getBaseType()));
    }

    if (foundTypes.isEmpty())
    {
        return;
    }

    processProducer.setProducer(new MockAwareProducerWrapper<T>(
        beanManager, originalProducer, foundTypes, qualifiers));
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:47,代码来源:MockExtension.java


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