Package com.io7m.cedarbridge.schema.ast

# Class CBASTMutableUserData

java.lang.Object
com.io7m.cedarbridge.schema.ast.CBASTMutableUserData

public final class CBASTMutableUserData extends Object
Mutable user data associated with AST elements. This structure is effectively a type-indexed heterogeneous map.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CBASTMutableUserData()`
  Construct an empty metadata map.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> T`
  `get(Class<T> clazz)`
  Get data from the map with the given type.
  `<T> void`
  `put(Class<T> clazz, T item)`
  Put a value into the user data, replacing any existing data of the same type.

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

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

- ## Constructor Details

  - ### CBASTMutableUserData

    public CBASTMutableUserData()
    Construct an empty metadata map.

- ## Method Details

  - ### put

    public <T> void put(Class<T> clazz, T item)
    Put a value into the user data, replacing any existing data of the same type.
    Type Parameters:
      `T` - The precise type of data
    Parameters:
      `clazz` - The user data type
      `item` - The data

  - ### get

    public <T> T get(Class<T> clazz) throws IllegalArgumentException
    Get data from the map with the given type.
    Type Parameters:
      `T` - The precise type of data
    Parameters:
      `clazz` - The user data type
    Returns:
      The data, if any
    Throws:
      `IllegalArgumentException` - If no data exists with the given type