Interface MutableCloudKeyContainer

All Superinterfaces:
CloudKeyContainer
All Known Subinterfaces:
AggregateParsingContext<C>
All Known Implementing Classes:
CommandContext, SimpleMutableCloudKeyContainer

@API(status=STABLE) public interface MutableCloudKeyContainer extends CloudKeyContainer
  • Method Details

    • store

      <V extends @NonNull Object> void store(@NonNull CloudKey<V> key, V value)
      Stores the key-value pair.

      This will overwrite any existing value stored with the same key.

      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      value - the value
    • store

      <V extends @NonNull Object> void store(@NonNull String key, V value)
      Stores the key-value pair.

      This will overwrite any existing value stored with the same key.

      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      value - the value
    • store

      default <V extends @NonNull Object> void store(@NonNull CloudKeyHolder<V> keyHolder, V value)
      Stores the key-value pair for the key held by the keyHolder.

      This will overwrite any existing value stored with the same key.

      Type Parameters:
      V - the type of the value
      Parameters:
      keyHolder - the holder of the key
      value - the value
    • remove

      void remove(@NonNull CloudKey<?> key)
      Removes value associated with the given key.
      Parameters:
      key - the key
    • remove

      default void remove(@NonNull String key)
      Removes value associated with the given key.
      Parameters:
      key - the key
    • remove

      default void remove(@NonNull CloudKeyHolder<?> keyHolder)
      Removes value associated with the given keyHolder.
      Parameters:
      keyHolder - the holder of the key
    • set

      default <V> void set(@NonNull CloudKey<V> key, @Nullable V value)
      Sets the value associated with the given key.

      If the value is null the key will be removed.

      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      value - the value
    • set

      default <V> void set(@NonNull String key, @Nullable V value)
      Sets the value associated with the given key.

      If the value is null the key will be removed.

      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      value - the value
    • set

      default <V> void set(@NonNull CloudKeyHolder<V> keyHolder, @Nullable V value)
      Sets the value associated with the given keyHolder.

      If the value is null the key will be removed.

      Type Parameters:
      V - the type of the value
      Parameters:
      keyHolder - the holder of the key
      value - the value
    • computeIfAbsent

      <V> V computeIfAbsent(@NonNull CloudKey<V> key, @NonNull Function<@NonNull CloudKey<V>,V> defaultFunction)
      Returns the value associated with the given key if it exists, else computes and stores the value returned by the given defaultFunction and then returns it.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      defaultFunction - the function used to generate the value in case it's missing
      Returns:
      the present or computed value
    • computeIfAbsent

      default <V> V computeIfAbsent(@NonNull CloudKeyHolder<V> keyHolder, @NonNull Function<@NonNull CloudKey<V>,V> defaultFunction)
      Returns the value associated with the given keyHolder if it exists, else computes and stores the value returned by the given defaultFunction and then returns it.
      Type Parameters:
      V - the type of the value
      Parameters:
      keyHolder - the holder of the key
      defaultFunction - the function used to generate the value in case it's missing
      Returns:
      the present or computed value