com.intellectualcrafters.jnbt

## Class CompoundTag

- java.lang.Object
- - com.intellectualcrafters.jnbt.Tag
  - - com.intellectualcrafters.jnbt.CompoundTag

-     public final class CompoundTag
      extends Tag

  The `TAG_Compound` tag.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompoundTag(java.util.Map<java.lang.String,Tag> value)` Creates the tag with an empty name.
    `CompoundTag(java.lang.String name, java.util.Map<java.lang.String,Tag> value)` Creates the tag.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `asDouble(java.lang.String key)` Get a double named with the given key, even if it's another type of number.
    `int` | `asInt(java.lang.String key)` Get an int named with the given key, even if it's another type of number.
    `long` | `asLong(java.lang.String key)` Get a long named with the given key, even if it's another type of number.
    `boolean` | `containsKey(java.lang.String key)` Returns whether this compound tag contains the given key.
    `CompoundTagBuilder` | `createBuilder()` Create a compound tag builder.
    `byte` | `getByte(java.lang.String key)` Get a byte named with the given key.
    `byte[]` | `getByteArray(java.lang.String key)` Get a byte array named with the given key.
    `double` | `getDouble(java.lang.String key)` Get a double named with the given key.
    `float` | `getFloat(java.lang.String key)` Get a float named with the given key.
    `int` | `getInt(java.lang.String key)` Get an int named with the given key.
    `int[]` | `getIntArray(java.lang.String key)` Get a `int[]` named with the given key.
    `java.util.List<Tag>` | `getList(java.lang.String key)` Get a list of tags named with the given key.
    `<T extends Tag> java.util.List<T>` | `getList(java.lang.String key, java.lang.Class<T> listType)` Get a list of tags named with the given key.
    `ListTag` | `getListTag(java.lang.String key)` Get a `TagList` named with the given key.
    `long` | `getLong(java.lang.String key)` Get a long named with the given key.
    `short` | `getShort(java.lang.String key)` Get a short named with the given key.
    `java.lang.String` | `getString(java.lang.String key)` Get a string named with the given key.
    `java.util.Map<java.lang.String,Tag>` | `getValue()` Gets the value of this tag.
    `CompoundTag` | `setValue(java.util.Map<java.lang.String,Tag> value)` Return a new compound tag with the given values.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class com.intellectualcrafters.jnbt.Tag

      `getName`

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

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

- - ### Constructor Detail

    - #### CompoundTag

          public CompoundTag(java.util.Map<java.lang.String,Tag> value)

      Creates the tag with an empty name.
      Parameters:
        `value` - the value of the tag

    - #### CompoundTag

          public CompoundTag(java.lang.String name,
                     java.util.Map<java.lang.String,Tag> value)

      Creates the tag.
      Parameters:
        `name` - the name of the tag
        `value` - the value of the tag

  - ### Method Detail

    - #### containsKey

          public boolean containsKey(java.lang.String key)

      Returns whether this compound tag contains the given key.
      Parameters:
        `key` - the given key
      Returns:
        true if the tag contains the given key

    - #### getValue

          public java.util.Map<java.lang.String,Tag> getValue()

      Description copied from class: `Tag`
      Gets the value of this tag.
      Specified by:
        `getValue` in class `Tag`
      Returns:
        the value

    - #### setValue

          public CompoundTag setValue(java.util.Map<java.lang.String,Tag> value)

      Return a new compound tag with the given values.
      Parameters:
        `value` - the value
      Returns:
        the new compound tag

    - #### createBuilder

          public CompoundTagBuilder createBuilder()

      Create a compound tag builder.
      Returns:
        the builder

    - #### getByteArray

          public byte[] getByteArray(java.lang.String key)

      Get a byte array named with the given key.

      If the key does not exist or its value is not a byte array tag, then an empty byte array will be returned.

      Parameters:
        `key` - the key
      Returns:
        a byte array

    - #### getByte

          public byte getByte(java.lang.String key)

      Get a byte named with the given key.

      If the key does not exist or its value is not a byte tag, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a byte

    - #### getDouble

          public double getDouble(java.lang.String key)

      Get a double named with the given key.

      If the key does not exist or its value is not a double tag, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a double

    - #### asDouble

          public double asDouble(java.lang.String key)

      Get a double named with the given key, even if it's another type of number.

      If the key does not exist or its value is not a number, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a double

    - #### getFloat

          public float getFloat(java.lang.String key)

      Get a float named with the given key.

      If the key does not exist or its value is not a float tag, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a float

    - #### getIntArray

          public int[] getIntArray(java.lang.String key)

      Get a `int[]` named with the given key.

      If the key does not exist or its value is not an int array tag, then an empty array will be returned.

      Parameters:
        `key` - the key
      Returns:
        an int array

    - #### getInt

          public int getInt(java.lang.String key)

      Get an int named with the given key.

      If the key does not exist or its value is not an int tag, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        an int

    - #### asInt

          public int asInt(java.lang.String key)

      Get an int named with the given key, even if it's another type of number.

      If the key does not exist or its value is not a number, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        an int

    - #### getList

          public java.util.List<Tag> getList(java.lang.String key)

      Get a list of tags named with the given key.

      If the key does not exist or its value is not a list tag, then an empty list will be returned.

      Parameters:
        `key` - the key
      Returns:
        a list of tags

    - #### getListTag

          public ListTag getListTag(java.lang.String key)

      Get a `TagList` named with the given key.

      If the key does not exist or its value is not a list tag, then an empty tag list will be returned.

      Parameters:
        `key` - the key
      Returns:
        a tag list instance

    - #### getList

          public <T extends Tag> java.util.List<T> getList(java.lang.String key,
                                                  java.lang.Class<T> listType)

      Get a list of tags named with the given key.

      If the key does not exist or its value is not a list tag, then an empty list will be returned. If the given key references a list but the list of of a different type, then an empty list will also be returned.

      Type Parameters:
        `T` - the type of list
      Parameters:
        `key` - the key
        `listType` - the class of the contained type
      Returns:
        a list of tags

    - #### getLong

          public long getLong(java.lang.String key)

      Get a long named with the given key.

      If the key does not exist or its value is not a long tag, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a long

    - #### asLong

          public long asLong(java.lang.String key)

      Get a long named with the given key, even if it's another type of number.

      If the key does not exist or its value is not a number, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a long

    - #### getShort

          public short getShort(java.lang.String key)

      Get a short named with the given key.

      If the key does not exist or its value is not a short tag, then `0` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a short

    - #### getString

          public java.lang.String getString(java.lang.String key)

      Get a string named with the given key.

      If the key does not exist or its value is not a string tag, then `""` will be returned.

      Parameters:
        `key` - the key
      Returns:
        a string

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`