Class KeyValueStore

java.lang.Object
com.github.kaktushose.jda.commands.dispatching.context.KeyValueStore

public class KeyValueStore extends Object
A simple key-value-store to store variables between events.
  • Constructor Details

    • KeyValueStore

      public KeyValueStore()
  • Method Details

    • get

      public <T> Optional<T> get(String key, @NotNull @NotNull Class<? extends T> clazz)
      Gets a value.
      Type Parameters:
      T - the type of the value
      Parameters:
      key - the key
      clazz - the class of the value
      Returns:
      an Optional holding the value
    • put

      public KeyValueStore put(String key, Object value)
      Associates the specified value with the specified key.
      Parameters:
      key - the key
      value - the value
      Returns:
      this instance for fluent interface
    • contains

      public boolean contains(String key)
      Whether this StateSection has a value mapped to the key.
      Parameters:
      key - the key
      Returns:
      true if this StateSection has a value mapped to the key
    • remove

      public KeyValueStore remove(String key)
      Removes the value mapping for a key.
      Parameters:
      key - key whose mapping is to be removed
      Returns:
      this instance for fluent interface
    • clear

      public KeyValueStore clear()
      Removes all the value mappings.
      Returns:
      this instance for fluent interface