java.lang.reflect.Executable.getAnnotations()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(185)

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

Executable.getAnnotations介绍

暂无

代码示例

代码示例来源:origin: com.oracle.truffle/truffle-api

static boolean isCallerSensitive(Executable method) {
  Annotation[] annotations = method.getAnnotations();
  for (Annotation annotation : annotations) {
    switch (annotation.annotationType().getName()) {
      case "sun.reflect.CallerSensitive":
      case "jdk.internal.reflect.CallerSensitive":
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.graalvm.truffle/truffle-api

static boolean isCallerSensitive(Executable method) {
  Annotation[] annotations = method.getAnnotations();
  for (Annotation annotation : annotations) {
    switch (annotation.annotationType().getName()) {
      case "sun.reflect.CallerSensitive":
      case "jdk.internal.reflect.CallerSensitive":
        return true;
    }
  }
  return false;
}

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

private boolean methodRequiresExplicitParamInjection(ParameterContext pc) {
  for (Annotation annotation : pc.getDeclaringExecutable().getAnnotations()) {
    if (annotation.annotationType().equals(ExplicitParamInjection.class)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: weld/weld-junit

private boolean methodRequiresExplicitParamInjection(ParameterContext pc) {
  for (Annotation annotation : pc.getDeclaringExecutable().getAnnotations()) {
    if (annotation.annotationType().equals(ExplicitParamInjection.class)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: com.oracle.substratevm/svm

private void warnAllMethods(MetaAccessProvider metaAccess, Class<?> clazz) {
  for (Executable m : clazz.getDeclaredMethods()) {
    /*
     * Filter out methods that are, e.g., only present on a certain platform. We do not need
     * all methods in the warning list, just enough to trigger the warnings. Accessors are
     * generally allowed too.
     */
    if (m.getAnnotations().length == 0 && !m.getName().startsWith("get") && !m.getName().startsWith("set")) {
      warnMethods.add(metaAccess.lookupJavaMethod(m));
    }
  }
  for (Executable m : clazz.getDeclaredConstructors()) {
    if (m.getAnnotations().length == 0) {
      warnMethods.add(metaAccess.lookupJavaMethod(m));
    }
  }
}

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

/**
 * Builds Key from parameter's parameterized type and and qualifying annotations
 * found on the parameter and its declaring executable (e.g. Method)
 *
 * @param parameter parameter for deriving type and annotations from
 * @return instance of a key
 */
public static Key<?> of(Parameter parameter)
{
 return new Key(parameter.getParameterizedType(),
         qualifiers(parameter.getAnnotations(),
              parameter.getDeclaringExecutable().getAnnotations()));
}

代码示例来源:origin: kasonyang/kalang

methods.addAll(Arrays.asList(clazz.getDeclaredConstructors()));
for (Executable m : methods) {
  NullableKind nullable = getNullable(m.getAnnotations());
  Type mType;
  String mName;
    methodNode.addExceptionType(getType(e,gTypeMap, e, NullableKind.NONNULL));
  for(Annotation a:m.getAnnotations()){
    methodNode.addAnnotation(transAnnotation(a));

相关文章