View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at 
7    * 
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software 
11   * distributed under the License is distributed on an "AS IS" BASIS, 
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License.
15   */
16  
17  
18  package org.apache.jdo.impl.enhancer.classfile;
19  
20  import java.io.*;
21  
22  /***
23   * ConstFieldRef represents a reference to a field of some class
24   * in the constant pool of a class file.
25   */
26  public class ConstFieldRef extends ConstBasicMemberRef {
27      /* The tag associated with ConstFieldRef */
28      public static final int MyTag = CONSTANTFieldRef;
29  
30      /* public accessors */
31      public int tag () { return MyTag; }
32  
33      public String toString () {
34          return "CONSTANTFieldRef(" + indexAsString() + "): " + 
35              super.toString();
36      }
37  
38      /* package local methods *//package-summary/html">class="comment"> package local methods *//package-summary.html">/* package local methods *//package-summary.html">class="comment"> package local methods */
39  
40      ConstFieldRef (ConstClass cname, ConstNameAndType NT) {
41          super(cname, NT);
42      }
43  
44      ConstFieldRef (int cnameIndex, int NT_index) {
45          super(cnameIndex, NT_index);
46      }
47  
48      static ConstFieldRef read (DataInputStream input) throws IOException {
49          int cname = input.readUnsignedShort();
50          int NT = input.readUnsignedShort();
51          return new ConstFieldRef (cname, NT);
52      }
53  }