Java????ASM??????????Field value???????о?
???????????? ???????[ 2013/2/21 9:45:13 ] ????????
??????????Spring????????У???????spring-asm????????′?????????????????о????asm??????????????????????????????????????????
???????????????????????????????????????汾????????svn/git?????????????′???????Java????????????????????????о????????????????????jar??????????????????? ???????2???????????????????′???????????????????????????????á???
????ASM svn?????
?????????????????????????????о???????????????????ASM?????class????????????????????????ASM???????????????????????????????????????????????????????????????????????????????????????tree API??????????????????????????????????????????????????????????ForReadClass?????????£?
/**
* @author lihzh
* @date 2012-4-21 ????10:18:46
*/
public class ForReadClass {
final int init = 110;
private final Integer intField = 120;
public final String stringField = "Public Final Strng Value";
public static String commStr = "Common String value";
String str = "Just a string value";
final double d = 1.1;
final Double D = 1.2;
public ForReadClass() {
}
public void methodA() {
System.out.println(intField);
}
}
????????д????????£?
/**
* @param args
* @author lihzh
* @date 2012-4-21 ????10:17:22
*/
ublic static void main(String[] args) {
try {
ClassReader reader = new ClassReader("cn.home.practice.bean.ForReadClass");
ClassNode cn = new ClassNode();
reader.accept(cn?? 0);
System.out.println(cn.name);
List<FieldNode> fieldList = cn.fields;
for (FieldNode fieldNode : fieldList) {
System.out.println("Field name: " + fieldNode.name);
System.out.println("Field desc: " + fieldNode.desc);
System.out.println("Filed value: " + fieldNode.value);
System.out.println("Filed access: " + fieldNode.access);
}
} catch (IOException e) {
e.printStackTrace();
}
?????????????????????????????Tree API??????????????Class??????????????е????????????????????????????????????????????vlaue???? null???????????ζ???????ForReadClass?У??????????????????????final???????????????????
?????????????????????????????ж??????????????filed?????????Integer/Double/....???????????????????final?????????????????????????????????????????????final???????????????????String??????????String s = "str"???????????????new String("str")??????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11