1
2 package jrre.classloader.classfile.pool_entries;
3
4 /***
5 * A constant pool field referance. It contains index's in the
6 * constant pool to a (class info) and a (name and type info). These
7 * are a fields parent class and its name and object type.
8 *
9 * For Example:
10 * <code>
11 * class Boat {
12 * public Motor m = new Motor();
13 * }
14 *
15 * Boat b = new Boat(); (class info) gets Boat
16 * (name and type info)
17 * (name) gets b
18 * (type) gets Boat
19 *
20 * </code>
21 *
22 * @author Christopher Ellsworth (Chris@chrisellsworth.com)
23 * @author Clarence Alston (massclax@hotmail.com)
24 */
25 public class CPFieldRef extends CPInfo {
26
27 private int classIndex;
28 private int nameType;
29
30 /***
31 * Gets the ClassIndex.
32 */
33 public int getClassIndex(){
34 return this.classIndex;
35 }
36
37 /***
38 * Sets the ClassIndex.
39 * @param ClassIndex The value to set it to.
40 */
41 public void setClassIndex(int classIndex) {
42 this.classIndex = classIndex;
43 }
44
45 public int getNameTypeIndex() {
46 return this.nameType;
47 }
48
49 /***
50 * Gets the NameType.
51 */
52 public int getNameType() {
53 return this.nameType;
54 }
55
56 /***
57 * Sets the NameType.
58 * @param NameType The value to set it to.
59 */
60 public void setNameType(int nameType) {
61 this.nameType = nameType;
62 }
63
64 /***
65 * Constructs the field referance.
66 *
67 * @param classIndex The index in the constant pool to the class
68 * that contains this field.
69 * @param nameType The index in the constant pool to the fields name
70 * and type.
71 */
72 public CPFieldRef(int classIndex,int nameType) {
73 this.classIndex = classIndex;
74 this.nameType = nameType;
75 }
76
77
78 /***
79 * Gets the string representation of this field referance.
80 *
81 * @return A string representing the field.
82 */
83 public String toString() {
84 return "FieldRef: classIndex = " + classIndex + " nameType = " + nameType;
85 }
86 }
This page was automatically generated by Maven