Package java.lang.reflect

Examples of java.lang.reflect.Parameter


    private static void method(String param1, Integer param2) {
    }

    @Test
    public void testGetJavaParameter() {
        Parameter param1 = new MockAnnotatedParameter(0).getJavaParameter();
        Parameter param2 = new MockAnnotatedParameter(1).getJavaParameter();

        Assert.assertEquals(String.class, param1.getParameterizedType());
        Assert.assertEquals(Integer.class, param2.getParameterizedType());
    }
View Full Code Here


  @Override
  public String[] getParameterNames(Method method) {
    Parameter[] parameters = method.getParameters();
    String[] parameterNames = new String[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      Parameter param = parameters[i];
      if (!param.isNamePresent()) {
        return null;
      }
      parameterNames[i] = param.getName();
    }
    return parameterNames;
  }
View Full Code Here

  @Override
  public String[] getParameterNames(Constructor<?> ctor) {
    Parameter[] parameters = ctor.getParameters();
    String[] parameterNames = new String[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      Parameter param = parameters[i];
      if (!param.isNamePresent()) {
        return null;
      }
      parameterNames[i] = param.getName();
    }
    return parameterNames;
  }
View Full Code Here

                Member member = injectionPoint.getMember();
                if (member instanceof Executable) {
                    // Method or constructor injection
                    Executable executable = (Executable) member;
                    AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) injectionPoint.getAnnotated();
                    Parameter parameter = executable.getParameters()[annotatedParameter.getPosition()];
                    named = new NamedLiteral(parameter.getName());
                } else {
                    named = new NamedLiteral(injectionPoint.getMember().getName());
                }

                qualifierInstance = QualifierInstance.of(named, store);
View Full Code Here

    );
  }

  @Override
  protected Set<MetaConstraint<?>> findTypeAnnotationConstraintsForExecutableParameter(Member member, int i) {
    Parameter parameter = ( (Executable) member ).getParameters()[i];
    try {
      return findTypeArgumentsConstraints(
          member,
          parameter.getAnnotatedType(),
          parameter.isAnnotationPresent( Valid.class )
      );
    }
    catch ( ArrayIndexOutOfBoundsException ex ) {
      log.warn( MESSAGES.constraintOnConstructorOfNonStaticInnerClass(), ex );
      return Collections.emptySet();
View Full Code Here

TOP

Related Classes of java.lang.reflect.Parameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.