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   * Class representing a reference to a method of some class in the
24   * constant pool of a class file
25   */
26  public class ConstMethodRef extends ConstBasicMemberRef {
27      /* The tag value associated with ConstMethodRef */
28      public static final int MyTag = CONSTANTMethodRef;
29  
30      /* public accessors */
31  
32      /***
33       * The tag of this constant entry
34       */
35      public int tag () { return MyTag; }
36  
37      /***
38       * A printable representation
39       */
40      public String toString () {
41          return "CONSTANTMethodRef(" + indexAsString() + "): " + 
42              super.toString();
43      }
44  
45      /* 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 */
46  
47      ConstMethodRef (ConstClass cname, ConstNameAndType NT) {
48          super(cname, NT);
49      }
50  
51      ConstMethodRef (int cnameIndex, int NT_index) {
52          super(cnameIndex, NT_index);
53      }
54  
55      static ConstMethodRef read (DataInputStream input) throws IOException {
56          int cname = input.readUnsignedShort();
57          int NT = input.readUnsignedShort();
58          return new ConstMethodRef (cname, NT);
59      }
60  }