1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.bcel.internal.classfile;
  23 
  24 
  25 import com.sun.org.apache.bcel.internal.Constants;
  26 import java.io.*;
  27 
  28 /**
  29  * This class represents a constant pool reference to a method.
  30  *
  31  * @author  <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  32  */
  33 public final class ConstantMethodref extends ConstantCP {
  34   /**
  35    * Initialize from another object.
  36    */
  37   public ConstantMethodref(ConstantMethodref c) {
  38     super(Constants.CONSTANT_Methodref, c.getClassIndex(), c.getNameAndTypeIndex());
  39   }
  40 
  41   /**
  42    * Initialize instance from file data.
  43    *
  44    * @param file input stream
  45    * @throws IOException
  46    */
  47   ConstantMethodref(DataInputStream file) throws IOException
  48   {
  49     super(Constants.CONSTANT_Methodref, file);
  50   }
  51 
  52   /**
  53    * @param class_index Reference to the class containing the method
  54    * @param name_and_type_index and the method signature
  55    */
  56   public ConstantMethodref(int class_index,
  57                            int name_and_type_index) {
  58     super(Constants.CONSTANT_Methodref, class_index, name_and_type_index);
  59   }
  60 
  61   /**
  62    * Called by objects that are traversing the nodes of the tree implicitely
  63    * defined by the contents of a Java class. I.e., the hierarchy of methods,
  64    * fields, attributes, etc. spawns a tree of objects.
  65    *
  66    * @param v Visitor object
  67    */
  68   public void accept(Visitor v) {
  69     v.visitConstantMethodref(this);
  70   }
  71 }