-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFieldAccessInstr.java
44 lines (37 loc) · 1.23 KB
/
FieldAccessInstr.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
package nl.rug.jbi.jsm.bcel;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.FieldInstruction;
import static nl.rug.jbi.jsm.bcel.BCELTools.type2className;
/**
* Represents access to the field of a class, this can be any class for which the field is accessible from the class
* being inspected in the current scope.
*
* @author David van Leusen
* @since 2014-05-28
*/
public class FieldAccessInstr {
private final FieldInstruction instruction;
private final ConstantPoolGen cp;
public FieldAccessInstr(final FieldInstruction instruction, final ConstantPoolGen cp) {
this.instruction = instruction;
this.cp = cp;
}
/**
* @return String representing the class that the referenced field belongs to.
*/
public String getClassName() {
return type2className(this.instruction.getReferenceType(this.cp));
}
/**
* @return Name of the referenced field.
*/
public String getFieldName() {
return this.instruction.getFieldName(this.cp);
}
/**
* @return String representing the type of the referenced field.
*/
public String getFieldType() {
return type2className(this.instruction.getFieldType(this.cp));
}
}