import java.lang.reflect.*;
1)メソッドを得る
Method a_method = null;
try {
a_method = an_object.getClass().getMethod("method_name", new Class[]{ String.class, .... });
} catch (Exception e) {
// In case of no such method, or an error.
}
2)メソッドを呼び出す
try {
a_method.invoke(an_object, new Object[]{ arg1, .... });
} catch (Exception e) {
// In case of some error.
}
0 件のコメント:
コメントを投稿