source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 4.2 KB
Line 
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 */
17package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
18
19import java.io.DataInputStream;
20import java.io.IOException;
21
22/**
23 * A InterfaceMethodRef CP Info
24 *
25 */
26public class InterfaceMethodRefCPInfo extends ConstantPoolEntry {
27 /** the class name of the class defining the interface method */
28 private String interfaceMethodClassName;
29 /** the name of the interface nmethod */
30 private String interfaceMethodName;
31 /** the method signature of the interface method */
32 private String interfaceMethodType;
33 /**
34 * the index into the constant pool of the class entry for the interface
35 * class
36 */
37 private int classIndex;
38 /**
39 * the index into the constant pool of the name and type entry
40 * describing the method
41 */
42 private int nameAndTypeIndex;
43
44 /** Constructor. */
45 public InterfaceMethodRefCPInfo() {
46 super(CONSTANT_INTERFACEMETHODREF, 1);
47 }
48
49 /**
50 * read a constant pool entry from a class stream.
51 *
52 * @param cpStream the DataInputStream which contains the constant pool
53 * entry to be read.
54 * @exception IOException if there is a problem reading the entry from
55 * the stream.
56 */
57 public void read(DataInputStream cpStream) throws IOException {
58 classIndex = cpStream.readUnsignedShort();
59 nameAndTypeIndex = cpStream.readUnsignedShort();
60 }
61
62 /**
63 * Resolve this constant pool entry with respect to its dependents in
64 * the constant pool.
65 *
66 * @param constantPool the constant pool of which this entry is a member
67 * and against which this entry is to be resolved.
68 */
69 public void resolve(ConstantPool constantPool) {
70 ClassCPInfo interfaceMethodClass
71 = (ClassCPInfo) constantPool.getEntry(classIndex);
72
73 interfaceMethodClass.resolve(constantPool);
74
75 interfaceMethodClassName = interfaceMethodClass.getClassName();
76
77 NameAndTypeCPInfo nt
78 = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex);
79
80 nt.resolve(constantPool);
81
82 interfaceMethodName = nt.getName();
83 interfaceMethodType = nt.getType();
84
85 super.resolve(constantPool);
86 }
87
88 /**
89 * Print a readable version of the constant pool entry.
90 *
91 * @return the string representation of this constant pool entry.
92 */
93 public String toString() {
94 String value;
95
96 if (isResolved()) {
97 value = "InterfaceMethod : Class = " + interfaceMethodClassName
98 + ", name = " + interfaceMethodName + ", type = "
99 + interfaceMethodType;
100 } else {
101 value = "InterfaceMethod : Class index = " + classIndex
102 + ", name and type index = " + nameAndTypeIndex;
103 }
104
105 return value;
106 }
107
108 /**
109 * Gets the name of the class defining the interface method
110 *
111 * @return the name of the class defining the interface method
112 */
113 public String getInterfaceMethodClassName() {
114 return interfaceMethodClassName;
115 }
116
117 /**
118 * Get the name of the interface method
119 *
120 * @return the name of the interface method
121 */
122 public String getInterfaceMethodName() {
123 return interfaceMethodName;
124 }
125
126 /**
127 * Gets the type of the interface method
128 *
129 * @return the interface method's type signature
130 */
131 public String getInterfaceMethodType() {
132 return interfaceMethodType;
133 }
134
135}
136
Note: See TracBrowser for help on using the repository browser.