Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9833b5f5e0b9d4e943a357cde2aa62ab1065a2f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*******************************************************************************
 * Copyright (c) 2000, 2018 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * This is an implementation of an early-draft specification developed under the Java
 * Community Process (JCP) and is made available for testing and evaluation purposes
 * only. The code is not compatible with any specification of the JCP.
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.core.util;

/**
 * Description of a constant pool entry as described in the JVM specifications.
 * Its contents is initialized according to its kind.
 *
 * This interface may be implemented by clients. Because of that questionable choice,
 * clients may have to cast to {@link IConstantPoolEntry3} to get access to the relevant content.
 *
 * @see IConstantPoolEntry2
 * @see IConstantPoolEntry3
 * @since 2.0
 */
public interface IConstantPoolEntry {

	/**
	 * Returns the type of this entry.
	 *
	 * @return the type of this entry
	 */
	int getKind();

	/**
	 * Returns the name index for a CONSTANT_Class type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the name index for a CONSTANT_Class type entry
	 * @see IConstantPoolConstant#CONSTANT_Class
	 */
	int getClassInfoNameIndex();

	/**
	 * Returns the class index for a CONSTANT_Fieldref,
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the class index for a CONSTANT_Fieldref,
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
	 * @see IConstantPoolConstant#CONSTANT_Methodref
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
	 */
	int getClassIndex();

	/**
	 * Returns the nameAndType index for a CONSTANT_Fieldref,
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref,
	 * CONSTANT_InvokeDynamic type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the nameAndType index for a CONSTANT_Fieldref,
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref,
	 * CONSTANT_InvokeDynamic type entry
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
	 * @see IConstantPoolConstant#CONSTANT_Methodref
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
	 * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
	 * @see IConstantPoolConstant#CONSTANT_Dynamic
	 */
	int getNameAndTypeIndex();

	/**
	 * Returns the string index for a CONSTANT_String type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the string index for a CONSTANT_String type entry
	 * @see IConstantPoolConstant#CONSTANT_String
	 */
	int getStringIndex();

	/**
	 * Returns the string value for a CONSTANT_String type entry.
	 * Returns null otherwise.
	 *
	 * @return the string value for a CONSTANT_String type entry
	 * @see IConstantPoolConstant#CONSTANT_String
	 */
	String getStringValue();

	/**
	 * Returns the integer value for a CONSTANT_Integer type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the integer value for a CONSTANT_Integer type entry
	 * @see IConstantPoolConstant#CONSTANT_Integer
	 */
	int getIntegerValue();

	/**
	 * Returns the float value for a CONSTANT_Float type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the float value for a CONSTANT_Float type entry
	 * @see IConstantPoolConstant#CONSTANT_Float
	 */
	float getFloatValue();

	/**
	 * Returns the double value for a CONSTANT_Double type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the double value for a CONSTANT_Double type entry
	 * @see IConstantPoolConstant#CONSTANT_Double
	 */
	double getDoubleValue();

	/**
	 * Returns the long value for a CONSTANT_Long type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the long value for a CONSTANT_Long type entry
	 * @see IConstantPoolConstant#CONSTANT_Long
	 */
	long getLongValue();

	/**
	 * Returns the descriptor index for a CONSTANT_NameAndType type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the descriptor index for a CONSTANT_NameAndType type entry
	 * @see IConstantPoolConstant#CONSTANT_NameAndType
	 */
	int getNameAndTypeInfoDescriptorIndex();

	/**
	 * Returns the name index for a CONSTANT_NameAndType type entry.
	 * The value is unspecified otherwise.
	 *
	 * @return the name index for a CONSTANT_NameAndType type entry
	 * @see IConstantPoolConstant#CONSTANT_NameAndType
	 */
	int getNameAndTypeInfoNameIndex();

	/**
	 * Returns the class name for a CONSTANT_Class type entry.
	 * Returns null otherwise.
	 *
	 * @return the class name for a CONSTANT_Class type entry
	 * @see IConstantPoolConstant#CONSTANT_Class
	 */
	char[] getClassInfoName();

	/**
	 * Returns the class name for a CONSTANT_Fieldref,
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry.
	 * Returns null otherwise.
	 *
	 * @return the class name for a CONSTANT_Fieldref,
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
	 * @see IConstantPoolConstant#CONSTANT_Methodref
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
	 */
	char[] getClassName();

	/**
	 * Returns the field name for a CONSTANT_Fieldref type entry.
	 * Returns null otherwise.
	 *
	 * @return the field name for a CONSTANT_Fieldref type entry
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
	 */
	char[] getFieldName();

	/**
	 * Returns the method name for a CONSTANT_Methodref, CONSTANT_InterfaceMethodref
	 * or CONSTANT_InvokeDynamic type entry.
	 * Returns null otherwise.
	 *
	 * @return the method name for a CONSTANT_Methodref, CONSTANT_InterfaceMethodref
	 * or CONSTANT_InvokeDynamic type entry
	 * @see IConstantPoolConstant#CONSTANT_Methodref
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
	 * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
	 * @see IConstantPoolConstant#CONSTANT_Dynamic
	 */
	char[] getMethodName();

	/**
	 * Returns the field descriptor value for a CONSTANT_Fieldref type entry. This value
	 * is set only when decoding the CONSTANT_Fieldref entry.
	 * Returns null otherwise.
	 *
	 * @return the field descriptor value for a CONSTANT_Fieldref type entry. This value
	 * is set only when decoding the CONSTANT_Fieldref entry
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
	 */
	char[] getFieldDescriptor();

	/**
	 * Returns the method descriptor value for a CONSTANT_Methodref or
	 * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref, CONSTANT_MethodType
	 * or CONSTANT_InvokeDynamic entry.
	 * 
	 * Returns null otherwise.
	 *
	 * @return the method descriptor value for a CONSTANT_Methodref,
	 * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref, CONSTANT_MethodType
	 * or CONSTANT_InvokeDynamic entry
	 *
	 * @see IConstantPoolConstant#CONSTANT_Methodref
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
	 * @see IConstantPoolConstant#CONSTANT_MethodType
	 * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
	 * @see IConstantPoolConstant#CONSTANT_Dynamic
	 */
	char[] getMethodDescriptor();

	/**
	 * Returns the utf8 value for a CONSTANT_Utf8 type entry. This value is set only when
	 * decoding a UTF8 entry.
	 * Returns null otherwise.
	 *
	 * @return the utf8 value for a CONSTANT_Utf8 type entry. This value is set only when
	 * decoding a UTF8 entry
	 * @see IConstantPoolConstant#CONSTANT_Utf8
	 */
	char[] getUtf8Value();

	/**
	 * Returns the utf8 length for a CONSTANT_Utf8 type entry. This value is set only when
	 * decoding a UTF8 entry.
	 * Returns null otherwise.
	 *
	 * @return the utf8 length for a CONSTANT_Utf8 type entry. This value is set only when
	 * decoding a UTF8 entry
	 * @see IConstantPoolConstant#CONSTANT_Utf8
	 */
	int getUtf8Length();
}

Back to the top