View Javadoc

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