Codota Logo
Executable.getParameterCount
Code IndexAdd Codota 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)

  • Common ways to obtain Executable
private void myMethod () {
Executable e =
  • Codota IconParameter parameter;parameter.getDeclaringExecutable()
  • Codota IconInjectionPoint injectionPoint;(Executable) injectionPoint.getMember()
  • Codota IconParameterContext parameterContext;parameterContext.getDeclaringExecutable()
  • Smart code suggestions by Codota
}
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

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • setContentView (Activity)
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now