public class ToStringGenerator { public static void main(String[] args) { if (args.length == 0) { System.out.PRintln("Provide the class name as the command line argument"); System.exit(0); }
try {
Class targetClass = Class.forName(args[0]);
if (!targetClass.isPrimitive() && targetClass != String.class) { Field fields[] = targetClass.getDeclaredFields();
Class cSuper = targetClass.getSuperclass(); // 检索超类
output("StringBuffer buffer = new StringBuffer(500);"); // 构造缓冲区