org.apache.tomcat.util.bcel.classfile

## Class ConstantPool

- java.lang.Object
- - org.apache.tomcat.util.bcel.classfile.ConstantPool

-     public class ConstantPool
      extends Object

  This class represents the constant pool, i.e., a table of constants, of a parsed classfile. It may contain null references, due to the JVM specification that skips an entry after an 8-byte constant (double, long) entry. Those interested in generating constant pools programmatically should see ConstantPoolGen.
  See Also:
    `Constant`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Constant` | `getConstant(int index)` Gets constant from constant pool.
    `Constant` | `getConstant(int index, byte tag)` Gets constant from constant pool and check whether it has the expected type.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getConstant

          public Constant getConstant(int index)

      Gets constant from constant pool.
      Parameters:
        `index` - Index in constant pool
      Returns:
        Constant value
      See Also:
        `Constant`

    - #### getConstant

          public Constant getConstant(int index,
                             byte tag)
                               throws ClassFormatException

      Gets constant from constant pool and check whether it has the expected type.
      Parameters:
        `index` - Index in constant pool
        `tag` - Tag of expected constant, i.e., its type
      Returns:
        Constant value
      Throws:
        `ClassFormatException` - If the constant is not of the expected type
      See Also:
        `Constant`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.