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

x33g5p2x  于2022-01-16 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(74)

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

AnnotatedConstructor.isAnnotationPresent介绍

暂无

代码示例

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

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

代码示例来源:origin: org.glassfish.jersey.ext.cdi/jersey-cdi1x

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

代码示例来源:origin: org.glassfish.jersey.containers.glassfish/jersey-gf-cdi

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

代码示例来源:origin: com.caucho/resin

private static boolean hasQualifierAnnotation(AnnotatedConstructor<?> ctor)
{
 return ctor.isAnnotationPresent(Inject.class);
}

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

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

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

public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) {
  for (AnnotatedConstructor<?> constructor : type.getConstructors()) {
    if (constructor.getParameters().isEmpty()) {
      return true;
    }
    if (constructor.isAnnotationPresent(Inject.class)) {
      return true;
    }
  }
  return false;
}

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

public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) {
  for (AnnotatedConstructor<?> constructor : type.getConstructors()) {
    if (constructor.getParameters().isEmpty()) {
      return true;
    }
    if (constructor.isAnnotationPresent(Inject.class)) {
      return true;
    }
  }
  return false;
}

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

public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) {
  for (AnnotatedConstructor<?> constructor : type.getConstructors()) {
    if (constructor.getParameters().isEmpty()) {
      return true;
    }
    if (constructor.isAnnotationPresent(Inject.class)) {
      return true;
    }
  }
  return false;
}

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

public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) {
  for (AnnotatedConstructor<?> constructor : type.getConstructors()) {
    if (constructor.getParameters().isEmpty()) {
      return true;
    }
    if (constructor.isAnnotationPresent(Inject.class)) {
      return true;
    }
  }
  return false;
}

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

public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) {
  for (AnnotatedConstructor<?> constructor : type.getConstructors()) {
    if (constructor.getParameters().isEmpty()) {
      return true;
    }
    if (constructor.isAnnotationPresent(Inject.class)) {
      return true;
    }
  }
  return false;
}

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

public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) {
  for (AnnotatedConstructor<?> constructor : type.getConstructors()) {
    if (constructor.getParameters().isEmpty()) {
      return true;
    }
    if (constructor.isAnnotationPresent(Inject.class)) {
      return true;
    }
  }
  return false;
}

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

private boolean isCDIOSGiConstructor(AnnotatedConstructor<T> constructor) {
  if (constructor.isAnnotationPresent(Inject.class)) {
    for (AnnotatedParameter parameter : constructor.getParameters()) {
      if (parameter.isAnnotationPresent(OSGiService.class)) {
        return true;
      }
    }
  }
  return false;
}

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

void observesCountrysidePAT(@Observes ProcessAnnotatedType<Countryside> event) {
  AnnotatedConstructorConfigurator<Countryside> annotatedConstructorConfigurator = event.configureAnnotatedType()
      .filterConstructors(constructor -> constructor.isAnnotationPresent(Inject.class)).findFirst().get();
  //add qualifier to each constructor param
  annotatedConstructorConfigurator.params().forEach(annotatedParam -> annotatedParam.add(Wild.WildLiteral.INSTANCE));
}

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

@Test
@SpecAssertion(section = PROCESS_ANNOTATED_TYPE, id = "bba")
public void configuratorInitializedWithOriginalAT() {
  AnnotatedType<Cat> catAT = getCurrentManager().getExtension(ProcessAnnotatedTypeObserver.class).getOriginalCatAT();
  assertTrue(catAT.isAnnotationPresent(RequestScoped.class));
  AnnotatedConstructor<Cat> annotatedConstructor = catAT.getConstructors().stream()
      .filter(ac -> ac.getParameters().size() == 1 && ac.getParameters().get(0).getBaseType().equals(Feed.class)).findFirst().get();
  assertTrue(annotatedConstructor.getParameters().iterator().next().isAnnotationPresent(Cats.class));
  assertTrue(annotatedConstructor.isAnnotationPresent(Inject.class));
}

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

/**
 * @param classLoader to use for creating the class in
 * @param annotatedType the annotatedType for which a subclass will get generated
 * @param <T>
 * @return the proxy class
 */
public synchronized <T> Class<T> createSubClass(ClassLoader classLoader, AnnotatedType<T> annotatedType)
    throws ProxyGenerationException
{
  Class<T> classToProxy = annotatedType.getJavaClass();
  Class<T> clazz = tryToLoadClass(classLoader, classToProxy);
  if (clazz != null)
  {
    return clazz;
  }
  String proxyClassName = getSubClassName(classToProxy);
  List<Method> methods = ClassUtil.getNonPrivateMethods(classToProxy, true);
  Method[] businessMethods = methods.toArray(new Method[methods.size()]);
  Constructor<T> cons = null;
  for (AnnotatedConstructor<T> c : annotatedType.getConstructors())
  {
    if (c.isAnnotationPresent(Inject.class))
    {
      cons = c.getJavaMember();
      break;
    }
  }
  clazz = createProxyClass(classLoader, proxyClassName, classToProxy, businessMethods, new Method[0], cons);
  return clazz;
}

代码示例来源:origin: com.sun.jersey/jersey-servlet

boolean methodHasEncodedAnnotation = constructor.isAnnotationPresent(Encoded.class);
for (AnnotatedParameter<T> parameter : constructor.getParameters()) {
  for (Annotation annotation : parameter.getAnnotations()) {

代码示例来源:origin: jersey/jersey-1.x

boolean methodHasEncodedAnnotation = constructor.isAnnotationPresent(Encoded.class);
for (AnnotatedParameter<T> parameter : constructor.getParameters()) {
  for (Annotation annotation : parameter.getAnnotations()) {

代码示例来源:origin: com.sun.jersey/jersey-bundle

boolean methodHasEncodedAnnotation = constructor.isAnnotationPresent(Encoded.class);
for (AnnotatedParameter<T> parameter : constructor.getParameters()) {
  for (Annotation annotation : parameter.getAnnotations()) {

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

private void initClassDeclaredEjbInterceptors() {
  Class<?>[] classDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(annotatedType);
  boolean excludeClassLevelAroundConstructInterceptors = constructor.isAnnotationPresent(ExcludeClassInterceptors.class);
  if (classDeclaredInterceptors != null) {
    for (Class<?> clazz : classDeclaredInterceptors) {
      InterceptorClassMetadata<?> interceptor = reader.getPlainInterceptorMetadata(clazz);
      for (InterceptionType interceptionType : InterceptionType.values()) {
        if (excludeClassLevelAroundConstructInterceptors && interceptionType.equals(InterceptionType.AROUND_CONSTRUCT)) {
          /*
           * @ExcludeClassInterceptors suppresses @AroundConstruct interceptors defined on class level
           */
          continue;
        }
        if (interceptor.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType))) {
          builder.interceptGlobal(interceptionType, null, Collections.<InterceptorClassMetadata<?>>singleton(interceptor), null);
        }
      }
    }
  }
}

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

static boolean hasAnnotation(AnnotatedType<?> type, Class<? extends Annotation> annotation) {
  if (type.isAnnotationPresent(annotation)) {
    return true;
  }
  for (AnnotatedMethod<?> method : type.getMethods()) {
    if (method.isAnnotationPresent(annotation)) {
      return true;
    }
  }
  for (AnnotatedConstructor<?> constructor : type.getConstructors()) {
    if (constructor.isAnnotationPresent(annotation)) {
      return true;
    }
  }
  for (AnnotatedField<?> field : type.getFields()) {
    if (field.isAnnotationPresent(annotation)) {
      return true;
    }
  }
  return false;
}

相关文章