Codota Logo
Executable.getParameterAnnotations
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using java.lang.reflect.Executable.getParameterAnnotations (Showing top 14 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

/**
 * 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: 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: org.junit.jupiter/junit-jupiter-engine

&& executable.getParameterAnnotations().length == executable.getParameterCount() - 1) {
origin: com.oracle.substratevm/library-support

  @Override
  public Object compute(MetaAccessProvider metaAccess, ResolvedJavaField original, ResolvedJavaField annotated, Object receiver) {
    Executable executable = (Executable) receiver;
    return executable.getParameterAnnotations();
  }
}
origin: org.eclipse.persistence/org.eclipse.persistence.moxy

  private boolean detectParameterConstraints(Executable c) {
    for (Annotation[] aa : c.getParameterAnnotations())
      for (Annotation a : aa) {
        final Class<? extends Annotation> annType = a.annotationType();
        if (knownConstraints.contains(annType)) {
          return true;
        }
        // detect custom annotations
        for (Annotation annOnAnnType : annType.getAnnotations()) {
          final Class<? extends Annotation> annTypeOnAnnType = annOnAnnType.annotationType();
          if (Constraint.class == annTypeOnAnnType) {
            knownConstraints.add(annType);
            return true;
          }
        }
      }
    return false;
  }
}
origin: com.github.XDean/spring-annotation

/**
 * 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();
  if (this.parameterIndex >= 0 && this.parameterIndex < annotationArray.length) {
   paramAnns = adaptAnnotationArray(annotationArray[this.parameterIndex]);
  } else {
   paramAnns = new Annotation[0];
  }
  this.parameterAnnotations = paramAnns;
 }
 return paramAnns;
}
origin: com.fitbur.core/core-hk2

public <T extends Annotation> Optional<T> findParameter(Injectee injectee, Class<T> type) {
  AnnotatedElement parent = injectee.getParent();
  Optional<T> annotation;
  if (parent instanceof Field) {
    Field field = (Field) parent;
    annotation = Optional.ofNullable(field.getAnnotation(type));
  } else {
    Executable executable = (Executable) parent;
    Annotation[][] annotations = executable.getParameterAnnotations();
    Annotation[] params = annotations[injectee.getPosition()];
    annotation = Stream.of(params)
        .parallel()
        .filter(p -> type.equals(p.annotationType()))
        .map(p -> (T) p)
        .findFirst();
  }
  return annotation;
}
origin: weld/weld-junit

private static List<Class<?>> getExecutableParameterTypes(Executable executable, Weld weld, boolean explicitInjection) {
  List<Class<?>> types = new ArrayList<>();
  if (explicitInjection) {
    Annotation[][] paramAnns = executable.getParameterAnnotations();
    Class<?>[] paramTypes = executable.getParameterTypes();
    for (int c = 0; c < paramAnns.length; ++c) {
      if (stream(paramAnns[c]).anyMatch(ann -> isAnnotated(ann.annotationType(), Qualifier.class) || isAnnotated(ann.annotationType(), NormalScope.class))) {
        weld.addBeanClass(paramTypes[c]);
        types.add(paramTypes[c]);
      }
    }
  } else {
    for (Class<?> paramType : executable.getParameterTypes()) {
      weld.addBeanClass(paramType);
      types.add(paramType);
    }
  }
  return types;
}
origin: org.jboss.weld/weld-junit5

private static List<Class<?>> getExecutableParameterTypes(Executable executable, Weld weld, boolean explicitInjection) {
  List<Class<?>> types = new ArrayList<>();
  if (explicitInjection) {
    Annotation[][] paramAnns = executable.getParameterAnnotations();
    Class<?>[] paramTypes = executable.getParameterTypes();
    for (int c = 0; c < paramAnns.length; ++c) {
      if (stream(paramAnns[c]).anyMatch(ann -> isAnnotated(ann.annotationType(), Qualifier.class) || isAnnotated(ann.annotationType(), NormalScope.class))) {
        weld.addBeanClass(paramTypes[c]);
        types.add(paramTypes[c]);
      }
    }
  } else {
    for (Class<?> paramType : executable.getParameterTypes()) {
      weld.addBeanClass(paramType);
      types.add(paramType);
    }
  }
  return types;
}
origin: org.minijax/minijax-core

private Provider<?>[] getParamProviders(final Key<?> key, final Executable executable, final Set<Key<?>> chain) {
  final Class<?>[] paramClasses = executable.getParameterTypes();
  final Type[] paramTypes = executable.getGenericParameterTypes();
  final Annotation[][] annotations = executable.getParameterAnnotations();
  final Provider<?>[] result = new Provider<?>[paramTypes.length];
  for (int i = 0; i < paramTypes.length; ++i) {
    result[i] = getParamProvider(key, paramClasses[i], paramTypes[i], annotations[i], chain);
  }
  return result;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.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: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

Executable executable = parameter.getDeclaringExecutable();
if (executable instanceof Constructor && ClassUtils.isInnerClass(executable.getDeclaringClass()) &&
    executable.getParameterAnnotations().length == executable.getParameterCount() - 1) {
origin: apache/servicemix-bundles

Executable executable = parameter.getDeclaringExecutable();
if (executable instanceof Constructor && ClassUtils.isInnerClass(executable.getDeclaringClass()) &&
    executable.getParameterAnnotations().length == executable.getParameterCount() - 1) {
java.lang.reflectExecutablegetParameterAnnotations

Popular methods of Executable

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

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • Menu (java.awt)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JFrame (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
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