package lecture.etc;

import java.io.IOException;
import java.lang.reflect.Method;

import jp.avaj.lib.debug.L;

/**
 * リフレクション - メソッド情報の取得 Java
 * 引数のタイプ、返値のタイプ、例外情報の取得
 */
class GetMethodInfo {
  public static void main(String[] args) {
    try {
      Class myClass = MyClass.class;
      Method[] methods = myClass.getDeclaredMethods();
      for (Method method : methods) {
        L.p("name="+method.getName());
        L.p("parameters=");
        Class[] paramTypes = method.getParameterTypes();
        for (Class paramType : paramTypes) {
          L.p(paramType.getName());
        }
        L.p("returnValue="+method.getReturnType().getName());
        Class[] exceptions = method.getExceptionTypes();
        L.p("exceptions=");
        for (Class exception : exceptions) {
          L.p(exception.getName());
        }
      }
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }
  static class MyClass {
    public static String method(String str,Integer i,long l) throws IOException {
      return "";
    }
  }
}
//---------------------------------------------------
//・目次 Javaエトセトラ
//  http://blogs.yahoo.co.jp/artery2020/40576157.html
//・目次 - Java入門
//  http://blogs.yahoo.co.jp/artery2020/39975776.html
//・目次 - ビジネスパーソンの常識と非常識
//  http://blogs.yahoo.co.jp/artery2020/39728331.html
//・目次 - 論理・発想・思考についての考察と鍛え方
//  http://blogs.yahoo.co.jp/artery2020/39657784.html
//---------------------------------------------------