code: @SuppressWarnings("unchecked")
    public <Metadata> Optional<Metadata> get(MetadataKey<Metadata> key) {
      return Optional.ofNullable((Metadata) metadataMap.get(key));
    }
docs: Get the metadata for the given metadata key.
  
  @param key The key of the metadata.
  @return The metadata, if found for that key.