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 package org.apache.bcel.classfile; 19 20 import java.io.DataInput; 21 import java.io.IOException; 22 23 import org.apache.bcel.Const; 24 25 /** 26 * This class represents a constant pool reference to an interface method. 27 * 28 * @version $Id$ 29 */ 30 public final class ConstantInterfaceMethodref extends ConstantCP { 31 32 /** 33 * Initialize from another object. 34 */ 35 public ConstantInterfaceMethodref(final ConstantInterfaceMethodref c) { 36 super(Const.CONSTANT_InterfaceMethodref, c.getClassIndex(), c.getNameAndTypeIndex()); 37 } 38 39 40 /** 41 * Initialize instance from input data. 42 * 43 * @param input input stream 44 * @throws IOException 45 */ 46 ConstantInterfaceMethodref(final DataInput input) throws IOException { 47 super(Const.CONSTANT_InterfaceMethodref, input); 48 } 49 50 51 /** 52 * @param class_index Reference to the class containing the method 53 * @param name_and_type_index and the method signature 54 */ 55 public ConstantInterfaceMethodref(final int class_index, final int name_and_type_index) { 56 super(Const.CONSTANT_InterfaceMethodref, class_index, name_and_type_index); 57 } 58 59 60 /** 61 * Called by objects that are traversing the nodes of the tree implicitely 62 * defined by the contents of a Java class. I.e., the hierarchy of methods, 63 * fields, attributes, etc. spawns a tree of objects. 64 * 65 * @param v Visitor object 66 */ 67 @Override 68 public void accept( final Visitor v ) { 69 v.visitConstantInterfaceMethodref(this); 70 } 71 } 72