1 /* 2 * Copyright (C) 2007 The Android Open Source Project 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 com.android.dx.rop.cst; 18 19 /** 20 * Constants of type {@code CONSTANT_InterfaceMethodref_info}. 21 */ 22 public final class CstInterfaceMethodRef 23 extends CstBaseMethodRef { 24 /** 25 * {@code null-ok;} normal {@link CstMethodRef} that corresponds to this 26 * instance, if calculated 27 */ 28 private CstMethodRef methodRef; 29 30 /** 31 * Constructs an instance. 32 * 33 * @param definingClass {@code non-null;} the type of the defining class 34 * @param nat {@code non-null;} the name-and-type 35 */ 36 public CstInterfaceMethodRef(CstType definingClass, CstNat nat) { 37 super(definingClass, nat); 38 methodRef = null; 39 } 40 41 /** {@inheritDoc} */ 42 @Override 43 public String typeName() { 44 return "ifaceMethod"; 45 } 46 47 /** 48 * Gets a normal (non-interface) {@link CstMethodRef} that corresponds to 49 * this instance. 50 * 51 * @return {@code non-null;} an appropriate instance 52 */ 53 public CstMethodRef toMethodRef() { 54 if (methodRef == null) { 55 methodRef = new CstMethodRef(getDefiningClass(), getNat()); 56 } 57 58 return methodRef; 59 } 60 } 61