congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Executable.getParameterCount
Code IndexAdd Tabnine to your IDE (free)

How to use
getParameterCount
method
in
java.lang.reflect.Executable

Best Java code snippets using java.lang.reflect.Executable.getParameterCount (Showing top 20 results out of 315)

origin: spring-projects/spring-framework

private static int validateIndex(Executable executable, int parameterIndex) {
  int count = executable.getParameterCount();
  Assert.isTrue(parameterIndex >= -1 && parameterIndex < count,
      () -> "Parameter index needs to be between -1 and " + (count - 1));
  return parameterIndex;
}
origin: jdbi/jdbi

int getParameterCount() {
  return executable.getParameterCount();
}
origin: org.springframework/spring-core

private static int validateIndex(Executable executable, int parameterIndex) {
  int count = executable.getParameterCount();
  Assert.isTrue(parameterIndex >= -1 && parameterIndex < count,
      () -> "Parameter index needs to be between -1 and " + (count - 1));
  return parameterIndex;
}
origin: spring-projects/spring-framework

/**
 * Return the generic type of the method/constructor parameter.
 * @return the parameter type (never {@code null})
 * @since 3.0
 */
public Type getGenericParameterType() {
  Type paramType = this.genericParameterType;
  if (paramType == null) {
    if (this.parameterIndex < 0) {
      Method method = getMethod();
      paramType = (method != null ? method.getGenericReturnType() : void.class);
    }
    else {
      Type[] genericParameterTypes = this.executable.getGenericParameterTypes();
      int index = this.parameterIndex;
      if (this.executable instanceof Constructor &&
          ClassUtils.isInnerClass(this.executable.getDeclaringClass()) &&
          genericParameterTypes.length == this.executable.getParameterCount() - 1) {
        // Bug in javac: type array excludes enclosing instance parameter
        // for inner classes with at least one generic constructor parameter,
        // so access it with the actual parameter index lowered by 1
        index = this.parameterIndex - 1;
      }
      paramType = (index >= 0 && index < genericParameterTypes.length ?
          genericParameterTypes[index] : getParameterType());
    }
    this.genericParameterType = paramType;
  }
  return paramType;
}
origin: org.junit.jupiter/junit-jupiter-params

private static boolean isNotPrivateAndAcceptsSingleStringArgument(Executable executable) {
  return isNotPrivate(executable) //
      && (executable.getParameterCount() == 1) //
      && (executable.getParameterTypes()[0] == String.class);
}
origin: spring-projects/spring-framework

/**
 * Return the annotations associated with the specific method/constructor parameter.
 */
public Annotation[] getParameterAnnotations() {
  Annotation[] paramAnns = this.parameterAnnotations;
  if (paramAnns == null) {
    Annotation[][] annotationArray = this.executable.getParameterAnnotations();
    int index = this.parameterIndex;
    if (this.executable instanceof Constructor &&
        ClassUtils.isInnerClass(this.executable.getDeclaringClass()) &&
        annotationArray.length == this.executable.getParameterCount() - 1) {
      // Bug in javac in JDK <9: annotation array excludes enclosing instance parameter
      // for inner classes, so access it with the actual parameter index lowered by 1
      index = this.parameterIndex - 1;
    }
    paramAnns = (index >= 0 && index < annotationArray.length ?
        adaptAnnotationArray(annotationArray[index]) : EMPTY_ANNOTATION_ARRAY);
    this.parameterAnnotations = paramAnns;
  }
  return paramAnns;
}
origin: org.springframework/spring-core

/**
 * Return the generic type of the method/constructor parameter.
 * @return the parameter type (never {@code null})
 * @since 3.0
 */
public Type getGenericParameterType() {
  Type paramType = this.genericParameterType;
  if (paramType == null) {
    if (this.parameterIndex < 0) {
      Method method = getMethod();
      paramType = (method != null ? method.getGenericReturnType() : void.class);
    }
    else {
      Type[] genericParameterTypes = this.executable.getGenericParameterTypes();
      int index = this.parameterIndex;
      if (this.executable instanceof Constructor &&
          ClassUtils.isInnerClass(this.executable.getDeclaringClass()) &&
          genericParameterTypes.length == this.executable.getParameterCount() - 1) {
        // Bug in javac: type array excludes enclosing instance parameter
        // for inner classes with at least one generic constructor parameter,
        // so access it with the actual parameter index lowered by 1
        index = this.parameterIndex - 1;
      }
      paramType = (index >= 0 && index < genericParameterTypes.length ?
          genericParameterTypes[index] : getParameterType());
    }
    this.genericParameterType = paramType;
  }
  return paramType;
}
origin: spring-projects/spring-framework

Executable executable = parameter.getDeclaringExecutable();
if (executable instanceof Constructor && ClassUtils.isInnerClass(executable.getDeclaringClass()) &&
    executable.getParameterAnnotations().length == executable.getParameterCount() - 1) {
origin: org.springframework/spring-core

/**
 * Return the annotations associated with the specific method/constructor parameter.
 */
public Annotation[] getParameterAnnotations() {
  Annotation[] paramAnns = this.parameterAnnotations;
  if (paramAnns == null) {
    Annotation[][] annotationArray = this.executable.getParameterAnnotations();
    int index = this.parameterIndex;
    if (this.executable instanceof Constructor &&
        ClassUtils.isInnerClass(this.executable.getDeclaringClass()) &&
        annotationArray.length == this.executable.getParameterCount() - 1) {
      // Bug in javac in JDK <9: annotation array excludes enclosing instance parameter
      // for inner classes, so access it with the actual parameter index lowered by 1
      index = this.parameterIndex - 1;
    }
    paramAnns = (index >= 0 && index < annotationArray.length ?
        adaptAnnotationArray(annotationArray[index]) : EMPTY_ANNOTATION_ARRAY);
    this.parameterAnnotations = paramAnns;
  }
  return paramAnns;
}
origin: AxonFramework/AxonFramework

ReflectionUtils.ensureAccessible(this.executable);
Parameter[] parameters = executable.getParameters();
this.parameterCount = executable.getParameterCount();
parameterResolvers = new ParameterResolver[parameterCount];
Class<?> supportedPayloadType = explicitPayloadType;
origin: org.junit.jupiter/junit-jupiter-engine

&& executable.getParameterAnnotations().length == executable.getParameterCount() - 1) {
origin: apache/servicecomb-java-chassis

 private List<String> getParameterNamesEx(Executable methodOrConstructor) {
  int parameterCount = methodOrConstructor.getParameterCount();
  List<String> parameterNames = new ArrayList<>(parameterCount);

  for (int i = 0; i < parameterCount; i++) {
   parameterNames.add(ParamUtils.getParameterName(methodOrConstructor, i));
  }
  return Collections.unmodifiableList(parameterNames);
 }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

private static int validateIndex(Executable executable, int parameterIndex) {
  int count = executable.getParameterCount();
  Assert.isTrue(parameterIndex >= -1 && parameterIndex < count,
      () -> "Parameter index needs to be between -1 and " + (count - 1));
  return parameterIndex;
}
origin: com.github.XDean/spring-annotation

private static int validateIndex(Executable executable, int parameterIndex) {
 int count = executable.getParameterCount();
 Assert.isTrue(parameterIndex < count, () -> "Parameter index needs to be between -1 and " + (count - 1));
 return parameterIndex;
}
origin: org.springframework.shell/spring-shell-core

/**
 * Return MethodParameters for each parameter of the given method/constructor.
 */
public static Stream<MethodParameter> createMethodParameters(Executable executable) {
  return IntStream.range(0, executable.getParameterCount())
    .mapToObj(i -> createMethodParameter(executable, i));
}
origin: org.apache.servicecomb/swagger-invocation-validator

 private List<String> getParameterNamesEx(Executable methodOrConstructor) {
  int parameterCount = methodOrConstructor.getParameterCount();
  List<String> parameterNames = new ArrayList<>(parameterCount);

  for (int i = 0; i < parameterCount; i++) {
   parameterNames.add(ParamUtils.getParameterName(methodOrConstructor, i));
  }
  return Collections.unmodifiableList(parameterNames);
 }
}
origin: org.apache.bval/bval-jsr

  private ConstraintTarget impliedConstraintTarget() {
    if (meta.getHost().getParameterCount() == 0) {
      return ConstraintTarget.RETURN_VALUE;
    }
    if (Void.TYPE.equals(meta.getType())) {
      return ConstraintTarget.PARAMETERS;
    }
    return null;
  }
}
origin: org.hibernate.validator/hibernate-validator

public List<String> getParameterNames(Executable executable) {
  //skip parameterless methods
  if ( executable.getParameterCount() == 0 ) {
    return Collections.emptyList();
  }
  if ( executable instanceof Method ) {
    return delegate.getParameterNames( (Method) executable );
  }
  else {
    return delegate.getParameterNames( (Constructor<?>) executable );
  }
}
origin: org.apache.bval/bval-jsr

ParameterD(Meta.ForParameter meta, int index, MetadataReader.ForContainer<Parameter> reader, P parent) {
  super(reader, parent);
  Validate.isTrue(index >= 0 && index < meta.getHost().getDeclaringExecutable().getParameterCount(),
    "Invalid parameter index %d", index);
  this.index = index;
  name = reader.meta.getName();
  type = resolveType();
}
origin: org.apache.tomee.patch/bval-jsr

ParameterD(Meta.ForParameter meta, int index, MetadataReader.ForContainer<Parameter> reader, P parent) {
  super(reader, parent);
  Validate.isTrue(index >= 0 && index < meta.getHost().getDeclaringExecutable().getParameterCount(),
    "Invalid parameter index %d", index);
  this.index = index;
  name = reader.meta.getName();
  type = resolveType();
}
java.lang.reflectExecutablegetParameterCount

Popular methods of Executable

  • getParameters
  • getDeclaringClass
  • getParameterTypes
  • getName
  • toGenericString
  • getGenericParameterTypes
  • getModifiers
  • getParameterAnnotations
  • getAnnotation
  • getAnnotations
  • isAnnotationPresent
  • isVarArgs
  • isAnnotationPresent,
  • isVarArgs,
  • getAnnotatedParameterTypes,
  • getAnnotatedReturnType,
  • getAnnotatedReceiverType,
  • getGenericExceptionTypes,
  • isSynthetic,
  • <init>,
  • getAnnotatedExceptionTypes

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • getResourceAsStream (ClassLoader)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now