Class Object를 이용하여 해당 Object 정보 얻기
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class ClassInfo {

	public static void main(String[] args) {
		try {
			Class c = Class.forName("domain.VoClass");
			Method m [] = c.getDeclaredMethods();
			Field f [] = c.getDeclaredFields();
			
			System.out.println(f.length);
			for (int i = 0; i < f.length; i++)
				System.out.println(f[i].toString());
			
			System.out.println(m.length);
			for (int i = 0; i < m.length; i++)
				System.out.println(m[i].toString());
			
		} catch (Throwable e) {
			System.err.println(e);
		}
	}

}

+ Recent posts