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

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

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

AnnotatedType.isAnnotationPresent介绍

暂无

代码示例

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

@Override
  public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType) {
    return annotatedType.isAnnotationPresent(annotationType);
  }
});

代码示例来源:origin: oracle/helidon

/**
   * Determines if annotation is present.
   *
   * @param annotationType Annotation type.
   * @return Outcome of test.
   */
  public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
    return CommandBinding.class.equals(annotationType) || delegate.isAnnotationPresent(annotationType);
  }
}

代码示例来源:origin: oracle/helidon

/**
 * Gather Application or resource classes to start.
 *
 * @param pit injection target
 * @param <T> any type
 */
@SuppressWarnings("unchecked")
public <T> void gatherApplications(@Observes ProcessInjectionTarget<T> pit) {
  AnnotatedType<T> at = pit.getAnnotatedType();
  if (!at.isAnnotationPresent(ApplicationScoped.class)) {
    return;
  }
  // class is annotated, let's make sure it is an application
  Class<?> theClass = at.getJavaClass();
  if (Application.class.isAssignableFrom(theClass)) {
    this.applications.add((Class<? extends Application>) theClass);
  } else {
    // still may be a jax-rs resource (with no application attached)
    if (at.isAnnotationPresent(Path.class)) {
      this.resourceClasses.add(theClass);
    }
  }
}

代码示例来源:origin: resteasy/Resteasy

public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
  {
   return delegate.isAnnotationPresent(annotationType);
  }
}

代码示例来源:origin: hibernate/hibernate-validator

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
  return wrappedType.isAnnotationPresent( annotationType );
}

代码示例来源:origin: resteasy/Resteasy

/**
* Set a default scope for each CDI bean which is a JAX-RS Provider.
*
* @param <T> type
* @param event event
* @param beanManager bean manager
*/
public <T> void observeProviders(@WithAnnotations({Provider.class}) @Observes ProcessAnnotatedType<T> event, BeanManager beanManager)
{
 setBeanManager(beanManager);
 AnnotatedType<T> annotatedType = event.getAnnotatedType();
 if(!annotatedType.getJavaClass().isInterface()
      && !isSessionBean(annotatedType)
      // This check is redundant for CDI 1.1 containers but required for CDI 1.0
      && annotatedType.isAnnotationPresent(Provider.class))
 {
   LogMessages.LOGGER.debug(Messages.MESSAGES.discoveredCDIBeanJaxRsProvider(annotatedType.getJavaClass().getCanonicalName()));
   event.setAnnotatedType(wrapAnnotatedType(annotatedType, applicationScopedLiteral));
   this.providers.add(annotatedType.getJavaClass());
 }
}

代码示例来源:origin: resteasy/Resteasy

/**
* Set a default scope for each CDI bean which is a JAX-RS Resource.
*
* @param <T> type
* @param event event
* @param beanManager bean manager
*/
public <T> void observeResources(@WithAnnotations({Path.class}) @Observes ProcessAnnotatedType<T> event, BeanManager beanManager)
{
 setBeanManager(beanManager);
 AnnotatedType<T> annotatedType = event.getAnnotatedType();
 if(!annotatedType.getJavaClass().isInterface()
      && !isSessionBean(annotatedType)
      // This check is redundant for CDI 1.1 containers but required for CDI 1.0
      && GetRestful.isRootResource(annotatedType.getJavaClass())
      && !annotatedType.isAnnotationPresent(Decorator.class))
 {
   LogMessages.LOGGER.debug(Messages.MESSAGES.discoveredCDIBeanJaxRsResource(annotatedType.getJavaClass().getCanonicalName()));
   event.setAnnotatedType(wrapAnnotatedType(annotatedType, requestScopedLiteral));
   this.resources.add(annotatedType.getJavaClass());
 }
}

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

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
  if (annotationType == Vetoed.class) {
    return false;
  }
  return annotatedType.isAnnotationPresent(annotationType);
}

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

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
  if (annotationType == Vetoed.class) {
    return false;
  }
  return annotatedType.isAnnotationPresent(annotationType);
}

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

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
  if (annotationType == Vetoed.class) {
    return false;
  }
  return annotatedType.isAnnotationPresent(annotationType);
}

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

/**
 * @return <code>true</code> if this AnnotatedType represents a CDI Interceptor
 *         defined via a {@link javax.interceptor.Interceptor} annotation
 */
public static boolean isCdiInterceptor(AnnotatedType<?> annotatedType)
{
  return annotatedType.isAnnotationPresent(javax.interceptor.Interceptor.class);
}

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

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> aClass)
{
  return original.isAnnotationPresent(aClass);
}

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

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
  if (annotationType == Vetoed.class) {
    return false;
  }
  return annotatedType.isAnnotationPresent(annotationType);
}

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

@Override
  public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
    return getAnnotation(annotationType) != null;
  }
}

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

public static boolean isVetoed(AnnotatedType<?> type) {
  if (type.isAnnotationPresent(Vetoed.class)) {
    return true;
  }
  return isPackageVetoed(type.getJavaClass().getPackage());
}

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

public static boolean isVetoed(AnnotatedType<?> type) {
  if (type.isAnnotationPresent(Vetoed.class)) {
    return true;
  }
  return isPackageVetoed(type.getJavaClass().getPackage());
}

代码示例来源:origin: org.jboss.seam.solder/seam-solder

void detectInterfaces(@Observes ProcessAnnotatedType<?> event, BeanManager beanManager)
{
 AnnotatedType<?> type = event.getAnnotatedType();
 if (type.isAnnotationPresent(MessageLogger.class))
 {
   messageLoggerTypes.add(type);
 }
}

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

private <A extends Annotation> void addSyntheticAnnotation(AnnotatedType<A> annotation, Annotation requiredMetaAnnotation) {
  if (requiredMetaAnnotation != null && !annotation.isAnnotationPresent(requiredMetaAnnotation.annotationType())) {
    // Add required meta annotation
    annotation = new AnnotatedTypeWrapper<A>(annotation, requiredMetaAnnotation);
  }
  getBeanManager().getServices().get(ClassTransformer.class).addSyntheticAnnotation(annotation, getBeanManager().getId());
  getBeanManager().getServices().get(MetaAnnotationStore.class).clearAnnotationData(annotation.getJavaClass());
}

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

private <A extends Annotation> void addSyntheticAnnotation(AnnotatedType<A> annotation, Annotation requiredMetaAnnotation) {
  if (requiredMetaAnnotation != null && !annotation.isAnnotationPresent(requiredMetaAnnotation.annotationType())) {
    // Add required meta annotation
    annotation = new AnnotatedTypeWrapper<A>(annotation, requiredMetaAnnotation);
  }
  getBeanManager().getServices().get(ClassTransformer.class).addSyntheticAnnotation(annotation, getBeanManager().getId());
  getBeanManager().getServices().get(MetaAnnotationStore.class).clearAnnotationData(annotation.getJavaClass());
}

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

private <A extends Annotation> void addSyntheticAnnotation(AnnotatedType<A> annotation, Annotation requiredMetaAnnotation) {
    if (requiredMetaAnnotation != null && !annotation.isAnnotationPresent(requiredMetaAnnotation.annotationType())) {
      // Add required meta annotation
      annotation = new AnnotatedTypeWrapper<A>(annotation, requiredMetaAnnotation);
    }
    getBeanManager().getServices().get(ClassTransformer.class).addSyntheticAnnotation(annotation, getBeanManager().getId());
    getBeanManager().getServices().get(MetaAnnotationStore.class).clearAnnotationData(annotation.getJavaClass());
  }
}

相关文章