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 field.
25   *
26   * @version $Id: ConstantFieldref.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 ConstantFieldref extends ConstantCP {
30  
31      /***
32       * Initialize from another object.
33       */
34      public ConstantFieldref(ConstantFieldref c) {
35          super(Constants.CONSTANT_Fieldref, 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      ConstantFieldref(DataInputStream file) throws IOException {
46          super(Constants.CONSTANT_Fieldref, file);
47      }
48  
49  
50      /***
51       * @param class_index Reference to the class containing the Field
52       * @param name_and_type_index and the Field signature
53       */
54      public ConstantFieldref(int class_index, int name_and_type_index) {
55          super(Constants.CONSTANT_Fieldref, 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 Fields,
62       * fields, attributes, etc. spawns a tree of objects.
63       *
64       * @param v Visitor object
65       */
66      public void accept( Visitor v ) {
67          v.visitConstantFieldref(this);
68      }
69  }