Community

How can get the initial member field value?

created by xeo show in Javassist - View the full discussion

Hello, dear all

 

I want to get the initial member field value via javassist, can that be achived?

 

For example, sample class as below. I just want exactly get the 2 for x, 3 for y, and "world" for str, and "hello" for s, and the string "new HashMap()" for hashMap (not the result of  new HashMap(), just the string "new HashMap()"). Can this be done via javassist? Thanks a lot.

 

---------------------------------

public class Point {
    static int x = 2;
    int y = 3;
    static String str = "world";

    String s = "hello";
    HashMap hashMap = new HashMap();

 

    void move(int m, int n) {
        x = x + m;
        y += n;
        hashMap.put("name", "hashmap");
    }

 

}

Reply to this message by going to Community

Start a new discussion in Javassist at Community