0 Replies Latest reply on Nov 16, 2004 5:53 AM by pedrodelgallego

    refelction

    pedrodelgallego

      I need to obtain the name of the parameter of a method

      I can obtain the annotation and the types of this parameters but no the names

      for (Field field : clazz.getFields()){
      for (Annotation annotation : field.getAnnotations()){
      System.out.printf("-- name %s ----> annotation %s\n",
      field.getName(), annotation.toString());
      }
      }
      for (Method method : clazz.getMethods()){
      System.out.printf(" %s\n",method.getName());
      for (Annotation annotation : method.getAnnotations()){
      System.out.printf("--- annotation from the mehod %s\n",
      annotation.toString());
      }

      for (Annotation[] annotationParameter : method.getParameterAnnotations() ) {
      for (GenericDeclaration parameter : method.getParameterTypes()) {
      System.out.printf("------ parameter %s\n", parameter.toString());
      }
      for (Annotation annot : annotationParameter ){
      System.out.printf("------------- anootation form parameter %s \n", annot.toString());
      }
      }

      with taht code i can see a lot of the method 6ý parameter, but no the name of the parameter. Any kwon how can i do that. How can I access to this parameters with Javaasist

      thanks in advance