389 public static Type[] getArgumentTypes(final Method method) {
390 Class<?>[] classes = method.getParameterTypes();
391 Type[] types = new Type[classes.length];
392 for (int i = classes.length - 1; i >= 0; --i) {
393 types[i] = getType(classes[i]);
394 }
395 return types;
396 }
397
398 /**
399 * Returns the Java type corresponding to the return type of the given
400 * method descriptor.
401 *
402 * @param methodDescriptor
403 * a method descriptor.
404 * @return the Java type corresponding to the return type of the given
405 * method descriptor.
406 */
407 public static Type getReturnType(final String methodDescriptor) {
408 char[] buf = methodDescriptor.toCharArray();
409 return getType(buf, methodDescriptor.indexOf(')') + 1);
410 }
411
412 /**
413 * Returns the Java type corresponding to the return type of the given
414 * method.
415 *
416 * @param method
417 * a method.
418 * @return the Java type corresponding to the return type of the given
419 * method.
420 */
421 public static Type getReturnType(final Method method) {
422 return getType(method.getReturnType());
423 }
424
425 /**
426 * Computes the size of the arguments and of the return value of a method.
427 *
428 * @param desc
429 * the descriptor of a method.
430 * @return the size of the arguments of the method (plus one for the
|
389 public static Type[] getArgumentTypes(final Method method) {
390 Class<?>[] classes = method.getParameterTypes();
391 Type[] types = new Type[classes.length];
392 for (int i = classes.length - 1; i >= 0; --i) {
393 types[i] = getType(classes[i]);
394 }
395 return types;
396 }
397
398 /**
399 * Returns the Java type corresponding to the return type of the given
400 * method descriptor.
401 *
402 * @param methodDescriptor
403 * a method descriptor.
404 * @return the Java type corresponding to the return type of the given
405 * method descriptor.
406 */
407 public static Type getReturnType(final String methodDescriptor) {
408 char[] buf = methodDescriptor.toCharArray();
409 int off = 1;
410 while (true) {
411 char car = buf[off++];
412 if (car == ')') {
413 return getType(buf, off);
414 } else if (car == 'L') {
415 while (buf[off++] != ';') {
416 }
417 }
418 }
419 }
420
421 /**
422 * Returns the Java type corresponding to the return type of the given
423 * method.
424 *
425 * @param method
426 * a method.
427 * @return the Java type corresponding to the return type of the given
428 * method.
429 */
430 public static Type getReturnType(final Method method) {
431 return getType(method.getReturnType());
432 }
433
434 /**
435 * Computes the size of the arguments and of the return value of a method.
436 *
437 * @param desc
438 * the descriptor of a method.
439 * @return the size of the arguments of the method (plus one for the
|