-
Notifications
You must be signed in to change notification settings - Fork 0
/
FetchObj.java
57 lines (51 loc) · 1.33 KB
/
FetchObj.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import sun.jvm.hotspot.tools.*;
import java.util.*;
public class FetchObj extends Tool implements Constants
{
private String className;
private String fieldName;
private String type;
private boolean verbose;
private Runnable visitor;
public FetchObj(String className,String fieldName,String type,boolean verbose)
{
this.className=className;
this.fieldName=fieldName;
this.type=type;
this.verbose=verbose;
if(STRING.equals(type))
{
visitor=new StringVisitor(className,fieldName,type,verbose);
}
else if(type.contains("[]"))
{
visitor=new PrimitiveArrayVisitor(className,fieldName,type,verbose);
}
else
{
visitor=new PrimitiveVisitor(className,fieldName,type,verbose);
}
}
public void run()
{
visitor.run();
}
public static void main(String[] args)
{
long start=System.currentTimeMillis();
String className=args[0];
String fieldName=args[1];
String type=args[2];
String verbose=args[3];
//pid args[4]
List<String> list=new ArrayList<String>();
for(int i=4;i<args.length;i++)
{
list.add(args[i]);
}
FetchObj fo=new FetchObj(className,fieldName,type,"true".equals(verbose)?true:false);
fo.start(list.toArray(new String[]{}));
System.out.println("done.cost:"+(System.currentTimeMillis()-start));
fo.stop();
}
}