1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.classfile;
18
19 import java.io.DataInputStream;
20 import java.io.IOException;
21 import org.apache.bcel.Constants;
22
23 /***
24 * This class represents a constant pool reference to a method.
25 *
26 * @version $Id: ConstantMethodref.java 386056 2006-03-15 11:31:56Z tcurdt $
27 * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
28 */
29 public final class ConstantMethodref extends ConstantCP {
30
31 /***
32 * Initialize from another object.
33 */
34 public ConstantMethodref(ConstantMethodref c) {
35 super(Constants.CONSTANT_Methodref, c.getClassIndex(), c.getNameAndTypeIndex());
36 }
37
38
39 /***
40 * Initialize instance from file data.
41 *
42 * @param file input stream
43 * @throws IOException
44 */
45 ConstantMethodref(DataInputStream file) throws IOException {
46 super(Constants.CONSTANT_Methodref, file);
47 }
48
49
50 /***
51 * @param class_index Reference to the class containing the method
52 * @param name_and_type_index and the method signature
53 */
54 public ConstantMethodref(int class_index, int name_and_type_index) {
55 super(Constants.CONSTANT_Methodref, class_index, name_and_type_index);
56 }
57
58
59 /***
60 * Called by objects that are traversing the nodes of the tree implicitely
61 * defined by the contents of a Java class. I.e., the hierarchy of methods,
62 * fields, attributes, etc. spawns a tree of objects.
63 *
64 * @param v Visitor object
65 */
66 public void accept( Visitor v ) {
67 v.visitConstantMethodref(this);
68 }
69 }