org.apache.bcel.classfile

## Class StackMapType

- java.lang.Object
- - org.apache.bcel.classfile.StackMapType

- All Implemented Interfaces:
    Cloneable

      public final class StackMapType
      extends Object
      implements Cloneable

  This class represents the type of a local variable or item on stack used in the StackMap entries.
  See Also:
    `StackMapEntry`, `StackMap`, `Const`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static StackMapType[]` | `EMPTY_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StackMapType(byte type, int index, ConstantPool constantPool)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `StackMapType` | `copy()`
    `void` | `dump(DataOutputStream file)` Dump type entries to file.
    `ConstantPool` | `getConstantPool()`
    `int` | `getIndex()`
    `byte` | `getType()`
    `boolean` | `hasIndex()`
    `void` | `setConstantPool(ConstantPool constantPool)`
    `void` | `setIndex(int index)`
    `void` | `setType(byte type)`
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### EMPTY_ARRAY

          public static final StackMapType[] EMPTY_ARRAY

  - ### Constructor Detail

    - #### StackMapType

          public StackMapType(byte type,
                              int index,
                              ConstantPool constantPool)

      Parameters:
        `type` - type tag as defined in the Constants interface
        `index` - index to constant pool, or byte code offset

  - ### Method Detail

    - #### copy

          public StackMapType copy()

      Returns:
        deep copy of this object

    - #### dump

          public void dump(DataOutputStream file)
                    throws IOException

      Dump type entries to file.
      Parameters:
        `file` - Output file stream
      Throws:
        `IOException` - if an I/O error occurs.

    - #### getConstantPool

          public ConstantPool getConstantPool()

      Returns:
        Constant pool used by this object.

    - #### getIndex

          public int getIndex()

      Returns:
        index to constant pool if type == ITEM_Object, or offset in byte code, if type == ITEM_NewObject, and -1 otherwise

    - #### getType

          public byte getType()

    - #### hasIndex

          public boolean hasIndex()

      Returns:
        true, if type is either ITEM_Object or ITEM_NewObject

    - #### setConstantPool

          public void setConstantPool(ConstantPool constantPool)

      Parameters:
        `constantPool` - Constant pool to be used for this object.

    - #### setIndex

          public void setIndex(int index)

    - #### setType

          public void setType(byte type)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      Returns:
        String representation

Copyright © 2004–2022 The Apache Software Foundation. All rights reserved.