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