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 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