Copyright (c) 2000, 2017 IBM Corporation and others. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0 Contributors: IBM Corporation - initial API and implementation
/******************************************************************************* * Copyright (c) 2000, 2017 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/
package org.eclipse.jdt.internal.core.util; import org.eclipse.jdt.core.util.IConstantPoolEntry;
Default implementation of IConstantPoolEntry
See Also:
  • ConstantPoolEntry2
Since:2.0
/** * Default implementation of IConstantPoolEntry * * @see ConstantPoolEntry2 * @since 2.0 */
public class ConstantPoolEntry implements IConstantPoolEntry { private int kind; private int classInfoNameIndex; private int classIndex; private int nameAndTypeIndex; private int stringIndex; private char[] stringValue; private int integerValue; private float floatValue; private double doubleValue; private long longValue; private int nameAndTypeDescriptorIndex; private int nameAndTypeNameIndex; private char[] className; private char[] fieldName; private char[] methodName; private char[] fieldDescriptor; private char[] methodDescriptor; private char[] utf8Value; private int utf8Length; private char[] classInfoName; public ConstantPoolEntry() { this.classInfoNameIndex = -1; this.classIndex = -1; this.nameAndTypeIndex = -1; this.stringIndex = -1; this.stringValue = null; this.integerValue = -1; this.floatValue = -0.0f; this.doubleValue = -0-0; this.longValue = -1; this.nameAndTypeDescriptorIndex = -1; this.nameAndTypeNameIndex = -1; this.className = null; this.fieldName = null; this.methodName = null; this.fieldDescriptor = null; this.methodDescriptor = null; this.utf8Value = null; this.utf8Length = -1; this.classInfoName = null; }
See Also:
  • getKind.getKind()
/** * @see IConstantPoolEntry#getKind() */
@Override public int getKind() { return this.kind; }
Sets the kind.
Params:
  • kind – The kind to set
/** * Sets the kind. * @param kind The kind to set */
public void setKind(int kind) { this.kind = kind; }
See Also:
  • getClassInfoNameIndex.getClassInfoNameIndex()
/** * @see IConstantPoolEntry#getClassInfoNameIndex() */
@Override public int getClassInfoNameIndex() { return this.classInfoNameIndex; }
See Also:
  • getClassIndex.getClassIndex()
/** * @see IConstantPoolEntry#getClassIndex() */
@Override public int getClassIndex() { return this.classIndex; }
See Also:
  • getNameAndTypeIndex.getNameAndTypeIndex()
/** * @see IConstantPoolEntry#getNameAndTypeIndex() */
@Override public int getNameAndTypeIndex() { return this.nameAndTypeIndex; }
See Also:
  • getStringIndex.getStringIndex()
/** * @see IConstantPoolEntry#getStringIndex() */
@Override public int getStringIndex() { return this.stringIndex; }
See Also:
  • getStringValue.getStringValue()
/** * @see IConstantPoolEntry#getStringValue() */
@Override public String getStringValue() { return new String(this.stringValue); }
See Also:
  • getIntegerValue.getIntegerValue()
/** * @see IConstantPoolEntry#getIntegerValue() */
@Override public int getIntegerValue() { return this.integerValue; }
See Also:
  • getFloatValue.getFloatValue()
/** * @see IConstantPoolEntry#getFloatValue() */
@Override public float getFloatValue() { return this.floatValue; }
See Also:
  • getDoubleValue.getDoubleValue()
/** * @see IConstantPoolEntry#getDoubleValue() */
@Override public double getDoubleValue() { return this.doubleValue; }
See Also:
  • getLongValue.getLongValue()
/** * @see IConstantPoolEntry#getLongValue() */
@Override public long getLongValue() { return this.longValue; }
See Also:
  • getNameAndTypeInfoDescriptorIndex.getNameAndTypeInfoDescriptorIndex()
/** * @see IConstantPoolEntry#getNameAndTypeInfoDescriptorIndex() */
@Override public int getNameAndTypeInfoDescriptorIndex() { return this.nameAndTypeDescriptorIndex; }
See Also:
  • getNameAndTypeInfoNameIndex.getNameAndTypeInfoNameIndex()
/** * @see IConstantPoolEntry#getNameAndTypeInfoNameIndex() */
@Override public int getNameAndTypeInfoNameIndex() { return this.nameAndTypeNameIndex; }
See Also:
  • getClassName.getClassName()
/** * @see IConstantPoolEntry#getClassName() */
@Override public char[] getClassName() { return this.className; }
See Also:
  • getFieldName.getFieldName()
/** * @see IConstantPoolEntry#getFieldName() */
@Override public char[] getFieldName() { return this.fieldName; }
See Also:
  • getMethodName.getMethodName()
/** * @see IConstantPoolEntry#getMethodName() */
@Override public char[] getMethodName() { return this.methodName; }
See Also:
  • getFieldDescriptor.getFieldDescriptor()
/** * @see IConstantPoolEntry#getFieldDescriptor() */
@Override public char[] getFieldDescriptor() { return this.fieldDescriptor; }
See Also:
  • getMethodDescriptor.getMethodDescriptor()
/** * @see IConstantPoolEntry#getMethodDescriptor() */
@Override public char[] getMethodDescriptor() { return this.methodDescriptor; }
See Also:
  • getUtf8Value.getUtf8Value()
/** * @see IConstantPoolEntry#getUtf8Value() */
@Override public char[] getUtf8Value() { return this.utf8Value; }
See Also:
  • getClassInfoName.getClassInfoName()
/** * @see IConstantPoolEntry#getClassInfoName() */
@Override public char[] getClassInfoName() { return this.classInfoName; }
Sets the classInfoNameIndex.
Params:
  • classInfoNameIndex – The classInfoNameIndex to set
/** * Sets the classInfoNameIndex. * @param classInfoNameIndex The classInfoNameIndex to set */
public void setClassInfoNameIndex(int classInfoNameIndex) { this.classInfoNameIndex = classInfoNameIndex; }
Sets the classIndex.
Params:
  • classIndex – The classIndex to set
/** * Sets the classIndex. * @param classIndex The classIndex to set */
public void setClassIndex(int classIndex) { this.classIndex = classIndex; }
Sets the nameAndTypeIndex.
Params:
  • nameAndTypeIndex – The nameAndTypeIndex to set
/** * Sets the nameAndTypeIndex. * @param nameAndTypeIndex The nameAndTypeIndex to set */
public void setNameAndTypeIndex(int nameAndTypeIndex) { this.nameAndTypeIndex = nameAndTypeIndex; }
Sets the stringIndex.
Params:
  • stringIndex – The stringIndex to set
/** * Sets the stringIndex. * @param stringIndex The stringIndex to set */
public void setStringIndex(int stringIndex) { this.stringIndex = stringIndex; }
Sets the stringValue.
Params:
  • stringValue – The stringValue to set
/** * Sets the stringValue. * @param stringValue The stringValue to set */
public void setStringValue(char[] stringValue) { this.stringValue = stringValue; }
Sets the integerValue.
Params:
  • integerValue – The integerValue to set
/** * Sets the integerValue. * @param integerValue The integerValue to set */
public void setIntegerValue(int integerValue) { this.integerValue = integerValue; }
Sets the floatValue.
Params:
  • floatValue – The floatValue to set
/** * Sets the floatValue. * @param floatValue The floatValue to set */
public void setFloatValue(float floatValue) { this.floatValue = floatValue; }
Sets the doubleValue.
Params:
  • doubleValue – The doubleValue to set
/** * Sets the doubleValue. * @param doubleValue The doubleValue to set */
public void setDoubleValue(double doubleValue) { this.doubleValue = doubleValue; }
Sets the longValue.
Params:
  • longValue – The longValue to set
/** * Sets the longValue. * @param longValue The longValue to set */
public void setLongValue(long longValue) { this.longValue = longValue; }
Gets the nameAndTypeDescriptorIndex.
Returns:Returns a int
/** * Gets the nameAndTypeDescriptorIndex. * @return Returns a int */
public int getNameAndTypeDescriptorIndex() { return this.nameAndTypeDescriptorIndex; }
Sets the nameAndTypeDescriptorIndex.
Params:
  • nameAndTypeDescriptorIndex – The nameAndTypeDescriptorIndex to set
/** * Sets the nameAndTypeDescriptorIndex. * @param nameAndTypeDescriptorIndex The nameAndTypeDescriptorIndex to set */
public void setNameAndTypeDescriptorIndex(int nameAndTypeDescriptorIndex) { this.nameAndTypeDescriptorIndex = nameAndTypeDescriptorIndex; }
Gets the nameAndTypeNameIndex.
Returns:Returns a int
/** * Gets the nameAndTypeNameIndex. * @return Returns a int */
public int getNameAndTypeNameIndex() { return this.nameAndTypeNameIndex; }
Sets the nameAndTypeNameIndex.
Params:
  • nameAndTypeNameIndex – The nameAndTypeNameIndex to set
/** * Sets the nameAndTypeNameIndex. * @param nameAndTypeNameIndex The nameAndTypeNameIndex to set */
public void setNameAndTypeNameIndex(int nameAndTypeNameIndex) { this.nameAndTypeNameIndex = nameAndTypeNameIndex; }
Sets the className.
Params:
  • className – The className to set
/** * Sets the className. * @param className The className to set */
public void setClassName(char[] className) { this.className = className; }
Sets the fieldName.
Params:
  • fieldName – The fieldName to set
/** * Sets the fieldName. * @param fieldName The fieldName to set */
public void setFieldName(char[] fieldName) { this.fieldName = fieldName; }
Sets the methodName.
Params:
  • methodName – The methodName to set
/** * Sets the methodName. * @param methodName The methodName to set */
public void setMethodName(char[] methodName) { this.methodName = methodName; }
Sets the fieldDescriptor.
Params:
  • fieldDescriptor – The fieldDescriptor to set
/** * Sets the fieldDescriptor. * @param fieldDescriptor The fieldDescriptor to set */
public void setFieldDescriptor(char[] fieldDescriptor) { this.fieldDescriptor = fieldDescriptor; }
Sets the methodDescriptor.
Params:
  • methodDescriptor – The methodDescriptor to set
/** * Sets the methodDescriptor. * * @param methodDescriptor The methodDescriptor to set */
public void setMethodDescriptor(char[] methodDescriptor) { this.methodDescriptor = methodDescriptor; }
Sets the utf8Value.
Params:
  • utf8Value – The utf8Value to set
/** * Sets the utf8Value. * @param utf8Value The utf8Value to set */
public void setUtf8Value(char[] utf8Value) { this.utf8Value = utf8Value; }
Sets the classInfoName.
Params:
  • classInfoName – The classInfoName to set
/** * Sets the classInfoName. * @param classInfoName The classInfoName to set */
public void setClassInfoName(char[] classInfoName) { this.classInfoName = classInfoName; }
See Also:
  • getUtf8Length.getUtf8Length()
/** * @see IConstantPoolEntry#getUtf8Length() */
@Override public int getUtf8Length() { return this.utf8Length; }
Sets the utf8Length.
Params:
  • utf8Length – The utf8Length to set
/** * Sets the utf8Length. * @param utf8Length The utf8Length to set */
public void setUtf8Length(int utf8Length) { this.utf8Length = utf8Length; } public void reset() { this.kind = 0; this.classInfoNameIndex = 0; this.classIndex = 0; this.nameAndTypeIndex = 0; this.stringIndex = 0; this.stringValue = null; this.integerValue = 0; this.floatValue = 0.0f; this.doubleValue = 0.0; this.longValue = 0L; this.nameAndTypeDescriptorIndex = 0; this.nameAndTypeNameIndex = 0; this.className = null; this.fieldName = null; this.methodName = null; this.fieldDescriptor = null; this.methodDescriptor = null; this.utf8Value = null; this.utf8Length = 0; this.classInfoName = null; } }