-
Notifications
You must be signed in to change notification settings - Fork 345
Expand file tree
/
Copy pathMethodInfo.java
More file actions
67 lines (54 loc) · 1.67 KB
/
Copy pathMethodInfo.java
File metadata and controls
67 lines (54 loc) · 1.67 KB
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
58
59
60
61
62
63
64
65
66
67
package com.datadog.debugger.instrumentation;
import com.datadog.debugger.util.ClassFileLines;
import datadog.trace.util.Strings;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
/** Data class to store all information related to a method (class, classloader, lines) */
public class MethodInfo {
private final ClassLoader classLoader;
private final ClassNode classNode;
private final MethodNode methodNode;
private final ClassFileLines classFileLines;
public MethodInfo(
ClassLoader classLoader,
ClassNode classNode,
MethodNode methodNode,
ClassFileLines classFileLines) {
this.classLoader = classLoader;
this.classNode = classNode;
this.methodNode = methodNode;
this.classFileLines = classFileLines;
}
public ClassLoader getClassLoader() {
return classLoader;
}
public ClassNode getClassNode() {
return classNode;
}
public String getMethodName() {
return methodNode.name;
}
public MethodNode getMethodNode() {
return methodNode;
}
public ClassFileLines getClassFileLines() {
return classFileLines;
}
public int getMethodStart() {
return classFileLines != null ? classFileLines.getMethodStart(methodNode) : -1;
}
public String getSignature() {
return methodNode.desc != null ? Types.descriptorToSignature(methodNode.desc) : null;
}
public String getSourceFileName() {
return classNode.sourceFile;
}
public String getTypeName() {
return Strings.getClassName(classNode.name);
}
@Override
public String toString() {
return String.format(
"MethodInfo{classNode=%s, methodNode=%s}", classNode.name, methodNode.desc);
}
}