Class DataMap

java.lang.Object
fr.robie.machineengine.api.data.DataMap
All Implemented Interfaces:
DataValue

public final class DataMap extends Object implements DataValue
An immutable string-keyed map of DataValues, preserving insertion order.
  • Field Details

    • EMPTY

      public static final DataMap EMPTY
  • Method Details

    • of

      @NotNull public static @NotNull DataMap of(@NotNull @NotNull Map<String, ? extends DataValue> entries)
    • builder

      @NotNull public static @NotNull DataMap.Builder builder()
    • kind

      @NotNull public @NotNull String kind()
      Specified by:
      kind in interface DataValue
      Returns:
      a short name of the value kind, for error messages
    • entries

      @NotNull public @NotNull Map<String, DataValue> entries()
    • keys

      @NotNull public @NotNull Set<String> keys()
    • size

      public int size()
    • has

      public boolean has(@NotNull @NotNull String key)
    • get

      @NotNull public @NotNull Optional<DataValue> get(@NotNull @NotNull String key)
    • require

      @NotNull public @NotNull Result<DataValue> require(@NotNull @NotNull String key)
    • getString

      @NotNull public @NotNull Result<String> getString(@NotNull @NotNull String key)
    • getLong

      @NotNull public @NotNull Result<Long> getLong(@NotNull @NotNull String key)
    • getInt

      @NotNull public @NotNull Result<Integer> getInt(@NotNull @NotNull String key)
    • getBool

      @NotNull public @NotNull Result<Boolean> getBool(@NotNull @NotNull String key)
    • getMap

      @NotNull public @NotNull Result<DataMap> getMap(@NotNull @NotNull String key)
    • getList

      @NotNull public @NotNull Result<DataValue.DataList> getList(@NotNull @NotNull String key)
    • with

      @NotNull public @NotNull DataMap with(@NotNull @NotNull String key, @NotNull @NotNull DataValue value)
      Returns:
      a copy with key set to value
    • without

      @NotNull public @NotNull DataMap without(@NotNull @NotNull String key)
      Returns:
      a copy without key
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object