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

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

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

Executable.getName介绍

暂无

代码示例

代码示例来源:origin: jooby-project/jooby

@SuppressWarnings("rawtypes")
 private static String key(final Executable exec) {
  if (exec instanceof Method) {
   return exec.getName() + Type.getMethodDescriptor((Method) exec);
  } else {
   return "<init>" + Type.getConstructorDescriptor((Constructor) exec);
  }
 }
}

代码示例来源:origin: oblac/jodd

/**
 * Takes given parameters references and returns reference set for given method or constructor.
 */
public BeanReferences[] resolveReferenceFromValues(final Executable methodOrCtor, final String... parameterReferences) {
  BeanReferences[] references = convertRefToReferences(parameterReferences);
  if (references == null || references.length == 0) {
    references = buildDefaultReferences(methodOrCtor);
  }
  if (methodOrCtor.getParameterTypes().length != references.length) {
    throw new PetiteException("Different number of method parameters and references for: " +
      methodOrCtor.getDeclaringClass().getName() + '#' + methodOrCtor.getName());
  }
  removeAllDuplicateNames(references);
  return references;
}

代码示例来源:origin: oblac/jodd

private BeanReferences[] updateReferencesWithDefaultsIfNeeded(final Executable methodOrCtor, BeanReferences[] references) {
  BeanReferences[] defaultReferences = buildDefaultReferences(methodOrCtor);
  if (references == null || references.length == 0) {
    references = defaultReferences;
  }
  if (methodOrCtor.getParameterTypes().length != references.length) {
    throw new PetiteException(
      "Different number of parameters and references for: " + methodOrCtor.getName());
  }
  // apply default parameters
  for (int i = 0; i < references.length; i++) {
    BeanReferences parameterReferences = references[i];
    if (parameterReferenceIsNotSet(parameterReferences)) {
      references[i] = defaultReferences[i];
    }
  }
  return references;
}

代码示例来源:origin: pholser/junit-quickcheck

private static String declarerName(Parameter p) {
    Executable exec = p.getDeclaringExecutable();
    return exec.getDeclaringClass().getName() + '.' + exec.getName();
  }
}

代码示例来源:origin: pholser/junit-quickcheck

@Override public Generator<?> parameter(Parameter parameter) {
  return produceGenerator(
    new ParameterTypeContext(
      parameter.getName(),
      parameter.getAnnotatedType(),
      parameter.getDeclaringExecutable().getName()
    ).annotate(parameter));
}

代码示例来源:origin: com.github.markusmo3.urm/urm-core

protected String getName() {
  return executable.getName();
}

代码示例来源:origin: leangen/graphql-spqr

public TypeMappingException(Executable executable, Parameter parameter, Exception cause) {
  super("Parameter \"" + parameter.getName() + "\" of method \"" + executable.getName() +
      "\" is missing generic type parameters and can not be mapped." +
      " For details and possible solutions see " + Urls.Errors.AMBIGUOUS_PARAMETER_TYPE, cause);
}

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

@Override
public String getName() {
  return getReflectionMethod().getName();
}

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

@Override
public String getName() {
  return getReflectionMethod().getName();
}

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

public static String getSimpleName(Executable executable) {
  return executable instanceof Constructor ? executable.getDeclaringClass().getSimpleName() : executable.getName();
}

代码示例来源:origin: io.airlift/parameternames

ParameterNameClassVisitor(Executable executable)
{
  super(Opcodes.ASM5);
  methodName = executable instanceof Constructor ? "<init>" : executable.getName();
  parameterTypes = Arrays.stream(executable.getParameterTypes())
      .map(Type::getType)
      .collect(toList());
  this.methodVisitor = new ParameterNameMethodVisitor(isStatic(executable.getModifiers()), parameterTypes);
}

代码示例来源:origin: com.pholser/junit-quickcheck-core

private static String declarerName(Parameter p) {
    Executable exec = p.getDeclaringExecutable();
    return exec.getDeclaringClass().getName() + '.' + exec.getName();
  }
}

代码示例来源:origin: com.github.jcustenborder.kafka.connect/kafka-connect-cdc-test

@Override
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
 boolean result = false;
 for (Class<? extends Annotation> annotationClass : annotationClasses()) {
  log.trace("Checking if {} is annotated with {}.", parameterContext.getDeclaringExecutable().getName(), annotationClass.getName());
  if (parameterContext.getParameter().isAnnotationPresent(annotationClass)) {
   log.trace("Found {} on {}.", annotationClass.getName(), parameterContext.getDeclaringExecutable().getName());
   result = true;
   break;
  }
 }
 return result;
}

代码示例来源:origin: org.jooby/jooby

@SuppressWarnings("rawtypes")
 private static String key(final Executable exec) {
  if (exec instanceof Method) {
   return exec.getName() + Type.getMethodDescriptor((Method) exec);
  } else {
   return "<init>" + Type.getConstructorDescriptor((Constructor) exec);
  }
 }
}

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

public static Signature of(Executable x) {
  return new Signature(x.getName(), x.getParameterTypes());
}

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

public static Signature of(Executable x) {
  return new Signature(x.getName(), x.getParameterTypes());
}

代码示例来源:origin: edu.berkeley.cs.jqf/jqf-fuzz

private ParameterTypeContext createParameterTypeContext(Parameter parameter) {
  Executable exec = parameter.getDeclaringExecutable();
  String declarerName = exec.getDeclaringClass().getName() + '.' + exec.getName();
  return new ParameterTypeContext(
          parameter.getName(),
          parameter.getAnnotatedType(),
          declarerName,
          typeVariables)
          .allowMixedTypes(true).annotate(parameter);
}

代码示例来源:origin: rohanpadhye/jqf

private ParameterTypeContext createParameterTypeContext(Parameter parameter) {
  Executable exec = parameter.getDeclaringExecutable();
  String declarerName = exec.getDeclaringClass().getName() + '.' + exec.getName();
  return new ParameterTypeContext(
          parameter.getName(),
          parameter.getAnnotatedType(),
          declarerName,
          typeVariables)
          .allowMixedTypes(true).annotate(parameter);
}

代码示例来源:origin: com.pholser/junit-quickcheck-core

@Override public Generator<?> parameter(Parameter parameter) {
  return produceGenerator(
    new ParameterTypeContext(
      parameter.getName(),
      parameter.getAnnotatedType(),
      parameter.getDeclaringExecutable().getName()
    ).annotate(parameter));
}

代码示例来源:origin: org.jodd/jodd-petite

/**
 * Takes given parameters references and returns reference set for given method or constructor.
 */
public BeanReferences[] resolveReferenceFromValues(final Executable methodOrCtor, final String... parameterReferences) {
  BeanReferences[] references = convertRefToReferences(parameterReferences);
  if (references == null || references.length == 0) {
    references = buildDefaultReferences(methodOrCtor);
  }
  if (methodOrCtor.getParameterTypes().length != references.length) {
    throw new PetiteException("Different number of method parameters and references for: " +
      methodOrCtor.getDeclaringClass().getName() + '#' + methodOrCtor.getName());
  }
  removeAllDuplicateNames(references);
  return references;
}

相关文章