package eminence.thinking.example.typeInfo.ShowMethods;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.regex.Pattern;
public class ShowMethods {
private static Pattern p = Pattern.compile("\\w+\\.");
public static void main(String[] args) {
String className = "java.util.regex.Pattern";
try{
Class<?> c = Class.forName(className);
Method[] methods = c.getMethods();
Constructor[] ctors = c.getConstructors();
for( Method method : methods ) {
System.out.println(p.matcher( method.toString()).replaceAll(""));
}
for( Constructor ctor : ctors) {
System.out.println(p.matcher( ctor.toString()).replaceAll(""));
}
}catch(Exception ex) {
System.out.println(ex);
}
}
}
检查目标类的全部方法信息
最新推荐文章于 2023-04-04 19:50:16 发布