View Javadoc

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