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

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

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

AnnotatedType.getAnnotations介绍

暂无

代码示例

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

@Override
public Set<Annotation> getAnnotations() {
  return annotatedType.getAnnotations();
}

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

/**
 * Constructor.
 *
 * @param delegate Type delegate.
 */
public InterceptorBindingAnnotatedType(AnnotatedType<T> delegate) {
  this.delegate = delegate;
  annotations = new HashSet<>(delegate.getAnnotations());
  annotations.add(LiteralCommandBinding.getInstance());
}

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

@Override
public Set<Annotation> getAnnotations() {
  return wrappedType.getAnnotations();
}

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

public JaxrsAnnotatedType(final AnnotatedType<TYPE> delegate, final Annotation scope)
{
 this.delegate = delegate;
 this.annotations.addAll(delegate.getAnnotations());
 this.annotations.add(scope);
}

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

private boolean isSessionBean(AnnotatedType<?> annotatedType)
{
 for (Annotation annotation : annotatedType.getAnnotations())
 {
   Class<?> annotationType = annotation.annotationType();
   if (annotationType.getName().equals(JAVAX_EJB_STATELESS) || annotationType.getName().equals(JAVAX_EJB_SINGLETON))
   {
    LogMessages.LOGGER.debug(Messages.MESSAGES.beanIsSLSBOrSingleton(annotatedType.getJavaClass()));
    return true; // Do not modify scopes of SLSBs and Singletons
   }
 }
 return false;
}

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

/**
* Find out if a given annotated type is explicitly bound to a scope.
*
* @param annotatedType annotated type
* @param manager bean manager
* @return true if and only if a given annotated type is annotated with a scope
*         annotation or with a stereotype which (transitively) declares a
*         scope
*/
public static boolean isScopeDefined(AnnotatedType<?> annotatedType, BeanManager manager)
{
 for (Annotation annotation : annotatedType.getAnnotations())
 {
   if (manager.isScope(annotation.annotationType()))
   {
    return true;
   }
   if (manager.isStereotype(annotation.annotationType()))
   {
    if (isScopeDefined(annotation.annotationType(), manager))
    {
      return true;
    }
   }
 }
 return false;
}

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

public JaxrsAnnotatedType(AnnotatedType<TYPE> delegate, Annotation scope)
{
 this.delegate = delegate;
 this.annotations.addAll(delegate.getAnnotations());
 this.annotations.add(scope);
}

代码示例来源:origin: io.smallrye/smallrye-fault-tolerance

public HystrixInterceptorBindingAnnotatedType(AnnotatedType<T> delegate) {
  this.delegate = delegate;
  annotations = new HashSet<>(delegate.getAnnotations());
  annotations.add(HystrixCommandBinding.Literal.INSTANCE);
}

代码示例来源:origin: org.apache.tomee.patch/bval-jsr

public BValAnnotatedType(final AnnotatedType<A> annotatedType) {
  delegate = annotatedType;
  annotations = new HashSet<>(annotatedType.getAnnotations());
  annotations.add(BValBindingLiteral.INSTANCE);
}

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

@Override
public Set<Annotation> getAnnotations() {
  Set<Annotation> annotations = new HashSet<Annotation>();
  for (Annotation a : annotatedType.getAnnotations()) {
    if (a.annotationType() != Vetoed.class) {
      annotations.add(a);
    }
  }
  return annotations;
}

代码示例来源:origin: org.graniteds/granite-server-cdi

public TideAnnotatedType(AnnotatedType<T> annotatedType, boolean component, boolean bean) {
  this.annotatedType = annotatedType;
  annotations = new HashSet<Annotation>(annotatedType.getAnnotations());
  if (component)
    annotations.add(componentQualifier);
  if (bean)
    annotations.add(beanQualifier);
}

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

@Override
public Set<Annotation> getAnnotations() {
  Set<Annotation> annotations = new HashSet<Annotation>();
  for (Annotation a : annotatedType.getAnnotations()) {
    if (a.annotationType() != Vetoed.class) {
      annotations.add(a);
    }
  }
  return annotations;
}

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

public static Class<? extends Annotation> getBeanDefiningAnnotationScope(AnnotatedType<?> annotatedType) {
  for (Annotation annotation : annotatedType.getAnnotations()) {
    if (annotation.annotationType().isAnnotationPresent(NormalScope.class) || annotation.annotationType().equals(Dependent.class)) {
      return annotation.annotationType();
    }
  }
  return null;
}

代码示例来源:origin: org.apache.portals.pluto/pluto-container

/**
* Construct the wrapper. 
*/
public PortletSessionScopedAnnotatedType(AnnotatedType<SessionScoped> type) {
 aType = type;
 annos.addAll(type.getAnnotations());
 annos.remove(Dummy.class.getAnnotation(SessionScoped.class));
 annos.add(Dummy.class.getAnnotation(PortletSessionScoped.class));
}

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

public static Class<? extends Annotation> getBeanDefiningAnnotationScope(AnnotatedType<?> annotatedType) {
  for (Annotation annotation : annotatedType.getAnnotations()) {
    if (annotation.annotationType().isAnnotationPresent(NormalScope.class) || annotation.annotationType().equals(Dependent.class)) {
      return annotation.annotationType();
    }
  }
  return null;
}

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

public static Class<? extends Annotation> getBeanDefiningAnnotationScope(AnnotatedType<?> annotatedType) {
  for (Annotation annotation : annotatedType.getAnnotations()) {
    if (annotation.annotationType().isAnnotationPresent(NormalScope.class) || annotation.annotationType().equals(Dependent.class)) {
      return annotation.annotationType();
    }
  }
  return null;
}

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

private DelegateAnnotatedField(AnnotatedField<Y> delegate) {
  this.original = delegate;
  this.annotationSet = processAnnotations(delegate.getAnnotations());
}

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

<T> void rewriteTestClassScope(@Observes ProcessAnnotatedType<T> pat, BeanManager beanManager) {
  AnnotatedType<T> annotatedType = pat.getAnnotatedType();
  if (annotatedType.getJavaClass().equals(testClass)) {
    // Replace any test class's scope with @Singleton
    Set<Annotation> annotations = annotatedType.getAnnotations().stream()
        .filter(annotation -> beanManager.isScope(annotation.annotationType()))
        .collect(Collectors.toSet());
    annotations.add(SINGLETON_LITERAL);
    pat.setAnnotatedType(new AnnotationRewritingAnnotatedType<>(annotatedType, annotations));
  }
}

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

public AnnotatedTypeWrapper(AnnotatedType<T> delegate, boolean keepOriginalAnnotations, Annotation... additionalAnnotations) {
  this.delegate = delegate;
  ImmutableSet.Builder<Annotation> builder = ImmutableSet.<Annotation> builder();
  if (keepOriginalAnnotations) {
    builder.addAll(delegate.getAnnotations());
  }
  for (Annotation annotation : additionalAnnotations) {
    builder.add(annotation);
  }
  this.annotations = builder.build();
}

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

public AnnotatedTypeWrapper(AnnotatedType<T> delegate, boolean keepOriginalAnnotations, Annotation... additionalAnnotations) {
  this.delegate = delegate;
  ImmutableSet.Builder<Annotation> builder = ImmutableSet.<Annotation> builder();
  if (keepOriginalAnnotations) {
    builder.addAll(delegate.getAnnotations());
  }
  for (Annotation annotation : additionalAnnotations) {
    builder.add(annotation);
  }
  this.annotations = builder.build();
}

相关文章