javax.enterprise.inject.spi.AnnotatedField.isAnnotationPresent()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中javax.enterprise.inject.spi.AnnotatedField.isAnnotationPresent()方法的一些代码示例,展示了AnnotatedField.isAnnotationPresent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnnotatedField.isAnnotationPresent()方法的具体详情如下:
包路径:javax.enterprise.inject.spi.AnnotatedField
类名称:AnnotatedField
方法名:isAnnotationPresent

AnnotatedField.isAnnotationPresent介绍

暂无

代码示例

代码示例来源:origin: org.jboss.weld.osgi/weld-osgi-core-extension

private boolean isCDIOSGiField(AnnotatedField<? super T> field) {
  if (field.isAnnotationPresent(Inject.class) && field.isAnnotationPresent(
      OSGiService.class)) {
    return true;
  }
  return false;
}

代码示例来源:origin: apache/cxf

private AnnotatedField<? super X> wrap(AnnotatedField<? super X> af) {
  if (af.isAnnotationPresent(Context.class)) {
    return new DelegateAnnotatedField<>(af);
  } else {
    return af;
  }
}

代码示例来源:origin: org.apache.cxf/cxf-integration-cdi

private AnnotatedField<? super X> wrap(AnnotatedField<? super X> af) {
  if (af.isAnnotationPresent(Context.class)) {
    return new DelegateAnnotatedField<>(af);
  } else {
    return af;
  }
}

代码示例来源:origin: apache/cxf

Set<Type> getContextFieldTypes() {
  return replacedFields.stream()
      .filter(f -> f.isAnnotationPresent(Context.class) || f.isAnnotationPresent(ContextResolved.class))
      .map(f -> f.getJavaMember().getAnnotatedType().getType())
      .collect(toSet());
}

代码示例来源:origin: org.apache.cxf/cxf-integration-cdi

Set<Type> getContextFieldTypes() {
  return replacedFields.stream()
      .filter(f -> f.isAnnotationPresent(Context.class) || f.isAnnotationPresent(ContextResolved.class))
      .map(f -> f.getJavaMember().getAnnotatedType().getType())
      .collect(toSet());
}

代码示例来源:origin: org.jboss.weld.se/weld-se

/**
 *
 * @param beanManager
 * @param field
 * @return <code>true</code> if the given field is annotated with an EE resource annotation, <code>false</code> otherwise
 */
public static boolean isEEResourceProducerField(BeanManagerImpl beanManager, AnnotatedField<?> field) {
  EJBApiAbstraction ejbApiAbstraction = beanManager.getServices().get(EJBApiAbstraction.class);
  PersistenceApiAbstraction persistenceApiAbstraction = beanManager.getServices().get(PersistenceApiAbstraction.class);
  WSApiAbstraction wsApiAbstraction = beanManager.getServices().get(WSApiAbstraction.class);
  return field.isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) || field.isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS)
      || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS)
      || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS)
      || field.isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS);
}

代码示例来源:origin: io.thorntail/container

private static <T> boolean isApplicable(AnnotatedType<T> at) {
  if (isApplicable(at.getJavaClass())) {
    return true;
  }
  Set<AnnotatedField<? super T>> fields = at.getFields();
  for (AnnotatedField<? super T> field : fields) {
    if (field.isAnnotationPresent(Configurable.class)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: thorntail/thorntail

private static <T> boolean isApplicable(AnnotatedType<T> at) {
  if (isApplicable(at.getJavaClass())) {
    return true;
  }
  Set<AnnotatedField<? super T>> fields = at.getFields();
  for (AnnotatedField<? super T> field : fields) {
    if (field.isAnnotationPresent(Configurable.class)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.wildfly.swarm/container

private static <T> boolean isApplicable(AnnotatedType<T> at) {
  if (isApplicable(at.getJavaClass())) {
    return true;
  }
  Set<AnnotatedField<? super T>> fields = at.getFields();
  for (AnnotatedField<? super T> field : fields) {
    if (field.isAnnotationPresent(Configurable.class)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

InjectionPointImpl(Bean<?> ownerBean, Collection<Annotation> qualifiers, AnnotatedField<?> annotatedField)
{
  this(ownerBean, annotatedField.getBaseType(), qualifiers, annotatedField,
      annotatedField.getJavaMember(), annotatedField.isAnnotationPresent(Delegate.class),
      annotatedField.getJavaMember() == null? false : Modifier.isTransient(annotatedField.getJavaMember().getModifiers()));
}

代码示例来源:origin: org.jboss.jsr299.tck/jsr299-tck-impl

private void validateManagedBean(AnnotatedType<Farm> type)
{
 assert type.getBaseType().equals(Farm.class);
 assert rawTypeSetMatches(type.getTypeClosure(), Farm.class, Object.class);
 assert type.getFields().size() == 1;
 assert type.getFields().iterator().next().isAnnotationPresent(Produces.class);
 assert type.getMethods().size() == 1;
 assert type.getMethods().iterator().next().isAnnotationPresent(Produces.class);
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

private void validateManagedBean(AnnotatedType<Farm> type) {
  assert type.getBaseType().equals(Farm.class);
  assert typeSetMatches(type.getTypeClosure(), Farm.class, Object.class);
  assert type.getFields().size() == 1;
  assert type.getFields().iterator().next().isAnnotationPresent(Produces.class);
  assert type.getMethods().size() == 1;
  assert type.getMethods().iterator().next().isAnnotationPresent(Produces.class);
}

代码示例来源:origin: weld/core

/**
 *
 * @param beanManager
 * @param field
 * @return <code>true</code> if the given field is annotated with an EE resource annotation, <code>false</code> otherwise
 */
public static boolean isEEResourceProducerField(BeanManagerImpl beanManager, AnnotatedField<?> field) {
  final ResourceInjectionFactory factory = beanManager.getServices().get(ResourceInjectionFactory.class);
  for (ResourceInjectionProcessor<?, ?> processor : factory) {
    if (field.isAnnotationPresent(processor.getMarkerAnnotation(beanManager))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

/**
 *
 * @param beanManager
 * @param field
 * @return <code>true</code> if the given field is annotated with an EE resource annotation, <code>false</code> otherwise
 */
public static boolean isEEResourceProducerField(BeanManagerImpl beanManager, AnnotatedField<?> field) {
  final ResourceInjectionFactory factory = beanManager.getServices().get(ResourceInjectionFactory.class);
  for (ResourceInjectionProcessor<?, ?> processor : factory) {
    if (field.isAnnotationPresent(processor.getMarkerAnnotation(beanManager))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: weld/core

/**
 *
 * @param beanManager
 * @param field
 * @return <code>true</code> if the given field is annotated with an EE resource annotation, <code>false</code> otherwise
 */
public static boolean isEEResourceProducerField(BeanManagerImpl beanManager, AnnotatedField<?> field) {
  final ResourceInjectionFactory factory = beanManager.getServices().get(ResourceInjectionFactory.class);
  for (ResourceInjectionProcessor<?, ?> processor : factory) {
    if (field.isAnnotationPresent(processor.getMarkerAnnotation(beanManager))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: weld/core

/**
 *
 * @param beanManager
 * @param field
 * @return <code>true</code> if the given field is annotated with an EE resource annotation, <code>false</code> otherwise
 */
public static boolean isEEResourceProducerField(BeanManagerImpl beanManager, AnnotatedField<?> field) {
  final ResourceInjectionFactory factory = beanManager.getServices().get(ResourceInjectionFactory.class);
  for (ResourceInjectionProcessor<?, ?> processor : factory) {
    if (field.isAnnotationPresent(processor.getMarkerAnnotation(beanManager))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

/**
 *
 * @param beanManager
 * @param field
 * @return <code>true</code> if the given field is annotated with an EE resource annotation, <code>false</code> otherwise
 */
public static boolean isEEResourceProducerField(BeanManagerImpl beanManager, AnnotatedField<?> field) {
  final ResourceInjectionFactory factory = beanManager.getServices().get(ResourceInjectionFactory.class);
  for (ResourceInjectionProcessor<?, ?> processor : factory) {
    if (field.isAnnotationPresent(processor.getMarkerAnnotation(beanManager))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: weld/core

/**
 * @param fieldInjectionPoint
 * @param beanManager
 * @return {@link ResourceInjection} for static producer field or <code>null</code> if required services are not supported or the field is not annotated
 *         with the specific marker annotation
 * @see StaticEEResourceProducerField
 */
protected <T, X> ResourceInjection<T> createStaticProducerFieldResourceInjection(FieldInjectionPoint<T, X> fieldInjectionPoint, BeanManagerImpl beanManager) {
  S injectionServices = getInjectionServices(beanManager);
  C processorContext = getProcessorContext(beanManager);
  if (injectionServices != null && fieldInjectionPoint.getAnnotated().isAnnotationPresent(getMarkerAnnotation(processorContext))
      && accept(fieldInjectionPoint.getAnnotated(), processorContext)) {
    return createFieldResourceInjection(fieldInjectionPoint, injectionServices, processorContext);
  }
  return null;
}

代码示例来源:origin: weld/core

/**
 * @param fieldInjectionPoint
 * @param beanManager
 * @return {@link ResourceInjection} for static producer field or <code>null</code> if required services are not supported or the field is not annotated
 *         with the specific marker annotation
 * @see StaticEEResourceProducerField
 */
protected <T, X> ResourceInjection<T> createStaticProducerFieldResourceInjection(FieldInjectionPoint<T, X> fieldInjectionPoint, BeanManagerImpl beanManager) {
  S injectionServices = getInjectionServices(beanManager);
  C processorContext = getProcessorContext(beanManager);
  if (injectionServices != null && fieldInjectionPoint.getAnnotated().isAnnotationPresent(getMarkerAnnotation(processorContext))
      && accept(fieldInjectionPoint.getAnnotated(), processorContext)) {
    return createFieldResourceInjection(fieldInjectionPoint, injectionServices, processorContext);
  }
  return null;
}

代码示例来源:origin: weld/core

/**
 * @param fieldInjectionPoint
 * @param beanManager
 * @return {@link ResourceInjection} for static producer field or <code>null</code> if required services are not supported or the field is not annotated
 *         with the specific marker annotation
 * @see StaticEEResourceProducerField
 */
protected <T, X> ResourceInjection<T> createStaticProducerFieldResourceInjection(FieldInjectionPoint<T, X> fieldInjectionPoint, BeanManagerImpl beanManager) {
  S injectionServices = getInjectionServices(beanManager);
  C processorContext = getProcessorContext(beanManager);
  if (injectionServices != null && fieldInjectionPoint.getAnnotated().isAnnotationPresent(getMarkerAnnotation(processorContext))
      && accept(fieldInjectionPoint.getAnnotated(), processorContext)) {
    return createFieldResourceInjection(fieldInjectionPoint, injectionServices, processorContext);
  }
  return null;
}

相关文章