001: /*******************************************************************************
002: * Copyright (c) 2000, 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.core.util;
011:
012: /**
013: * Description of a constant pool entry as described in the JVM specifications.
014: * Its contents is initialized according to its kind.
015: *
016: * This interface may be implemented by clients.
017: *
018: * @since 2.0
019: */
020: public interface IConstantPoolEntry {
021:
022: /**
023: * Returns the type of this entry.
024: *
025: * @return the type of this entry
026: */
027: int getKind();
028:
029: /**
030: * Returns the name index for a CONSTANT_Class type entry.
031: * The value is unspecified otherwise.
032: *
033: * @return the name index for a CONSTANT_Class type entry
034: */
035: int getClassInfoNameIndex();
036:
037: /**
038: * Returns the class index for a CONSTANT_Fieldref,
039: * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry.
040: * The value is unspecified otherwise.
041: *
042: * @return the class index for a CONSTANT_Fieldref,
043: * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
044: */
045: int getClassIndex();
046:
047: /**
048: * Returns the nameAndType index for a CONSTANT_Fieldref,
049: * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry.
050: * The value is unspecified otherwise.
051: *
052: * @return the nameAndType index for a CONSTANT_Fieldref,
053: * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
054: */
055: int getNameAndTypeIndex();
056:
057: /**
058: * Returns the string index for a CONSTANT_String type entry.
059: * The value is unspecified otherwise.
060: *
061: * @return the string index for a CONSTANT_String type entry
062: */
063: int getStringIndex();
064:
065: /**
066: * Returns the string value for a CONSTANT_String type entry.
067: * Returns null otherwise.
068: *
069: * @return the string value for a CONSTANT_String type entry
070: */
071: String getStringValue();
072:
073: /**
074: * Returns the integer value for a CONSTANT_Integer type entry.
075: * The value is unspecified otherwise.
076: *
077: * @return the integer value for a CONSTANT_Integer type entry
078: */
079: int getIntegerValue();
080:
081: /**
082: * Returns the float value for a CONSTANT_Float type entry.
083: * The value is unspecified otherwise.
084: *
085: * @return the float value for a CONSTANT_Float type entry
086: */
087: float getFloatValue();
088:
089: /**
090: * Returns the double value for a CONSTANT_Double type entry.
091: * The value is unspecified otherwise.
092: *
093: * @return the double value for a CONSTANT_Double type entry
094: */
095: double getDoubleValue();
096:
097: /**
098: * Returns the long value for a CONSTANT_Long type entry.
099: * The value is unspecified otherwise.
100: *
101: * @return the long value for a CONSTANT_Long type entry
102: */
103: long getLongValue();
104:
105: /**
106: * Returns the descriptor index for a CONSTANT_NameAndType type entry.
107: * The value is unspecified otherwise.
108: *
109: * @return the descriptor index for a CONSTANT_NameAndType type entry
110: */
111: int getNameAndTypeInfoDescriptorIndex();
112:
113: /**
114: * Returns the name index for a CONSTANT_NameAndType type entry.
115: * The value is unspecified otherwise.
116: *
117: * @return the name index for a CONSTANT_NameAndType type entry
118: */
119: int getNameAndTypeInfoNameIndex();
120:
121: /**
122: * Returns the class name for a CONSTANT_Class type entry.
123: * Returns null otherwise.
124: *
125: * @return the class name for a CONSTANT_Class type entry
126: */
127: char[] getClassInfoName();
128:
129: /**
130: * Returns the class name for a CONSTANT_Fieldref,
131: * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry.
132: * Returns null otherwise.
133: *
134: * @return the class name for a CONSTANT_Fieldref,
135: * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
136: */
137: char[] getClassName();
138:
139: /**
140: * Returns the field name for a CONSTANT_Fieldref type entry.
141: * Returns null otherwise.
142: *
143: * @return the field name for a CONSTANT_Fieldref type entry
144: */
145: char[] getFieldName();
146:
147: /**
148: * Returns the field name for a CONSTANT_Methodref or CONSTANT_InterfaceMethodred
149: * type entry.
150: * Returns null otherwise.
151: *
152: * @return the field name for a CONSTANT_Methodref or CONSTANT_InterfaceMethodred
153: * type entry
154: */
155: char[] getMethodName();
156:
157: /**
158: * Returns the field descriptor value for a CONSTANT_Fieldref type entry. This value
159: * is set only when decoding the CONSTANT_Fieldref entry.
160: * Returns null otherwise.
161: *
162: * @return the field descriptor value for a CONSTANT_Fieldref type entry. This value
163: * is set only when decoding the CONSTANT_Fieldref entry
164: */
165: char[] getFieldDescriptor();
166:
167: /**
168: * Returns the method descriptor value for a CONSTANT_Methodref or
169: * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
170: * CONSTANT_Methodref or CONSTANT_InterfaceMethodref entry.
171: * Returns null otherwise.
172: *
173: * @return the method descriptor value for a CONSTANT_Methodref or
174: * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
175: * CONSTANT_Methodref or CONSTANT_InterfaceMethodref entry
176: */
177: char[] getMethodDescriptor();
178:
179: /**
180: * Returns the utf8 value for a CONSTANT_Utf8 type entry. This value is set only when
181: * decoding a UTF8 entry.
182: * Returns null otherwise.
183: *
184: * @return the utf8 value for a CONSTANT_Utf8 type entry. This value is set only when
185: * decoding a UTF8 entry
186: */
187: char[] getUtf8Value();
188:
189: /**
190: * Returns the utf8 length for a CONSTANT_Utf8 type entry. This value is set only when
191: * decoding a UTF8 entry.
192: * Returns null otherwise.
193: *
194: * @return the utf8 length for a CONSTANT_Utf8 type entry. This value is set only when
195: * decoding a UTF8 entry
196: */
197: int getUtf8Length();
198: }
|