Interface CloudKeyContainer

All Known Subinterfaces:
AggregateParsingContext<C>, MutableCloudKeyContainer
All Known Implementing Classes:
CommandContext, CommandMeta, SimpleCommandMeta, SimpleMutableCloudKeyContainer

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

    • optional

      <V extends @NonNull Object> @NonNull Optional<V> optional(@NonNull CloudKey<V> key)
      Returns the value associated with the given key.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      Returns:
      the value
    • optional

      <V extends @NonNull Object> @NonNull Optional<V> optional(@NonNull String key)
      Returns the value associated with the given key.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      Returns:
      the value
    • optional

      default <V extends @NonNull Object> @NonNull Optional<V> optional(@NonNull CloudKeyHolder<V> keyHolder)
      Returns the value associated with the given keyHolder.
      Type Parameters:
      V - the type of the value
      Parameters:
      keyHolder - the holder of the key
      Returns:
      the value
    • getOrDefault

      default <V> V getOrDefault(@NonNull CloudKey<@NonNull V> key, V defaultValue)
      Returns the value associated with the given key if it exists, or else the defaultValue.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      defaultValue - the default value to use if the value isn't present
      Returns:
      the value
    • getOrDefault

      default <V> V getOrDefault(@NonNull String key, V defaultValue)
      Returns the value associated with the given key if it exists, or else the defaultValue.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      defaultValue - the default value to use if the value isn't present
      Returns:
      the value
    • getOrDefault

      default <V> V getOrDefault(@NonNull CloudKeyHolder<@NonNull V> keyHolder, V defaultValue)
      Returns the value associated with the given keyHolder if it exists, or else the defaultValue.
      Type Parameters:
      V - the type of the value
      Parameters:
      keyHolder - the holder of the key
      defaultValue - the default value to use if the value isn't present
      Returns:
      the value
    • getOrSupplyDefault

      default <V> V getOrSupplyDefault(@NonNull CloudKey<@NonNull V> key, @NonNull Supplier<V> supplier)
      Returns the value associated with the given key if it exists, or else the value supplied by the given supplier
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      supplier - supplier of the default value
      Returns:
      the value
    • getOrSupplyDefault

      default <V> V getOrSupplyDefault(@NonNull String key, @NonNull Supplier<V> supplier)
      Returns the value associated with the given key if it exists, or else the value supplied by the given supplier
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      supplier - supplier of the default value
      Returns:
      the value
    • getOrSupplyDefault

      default <V> V getOrSupplyDefault(@NonNull CloudKeyHolder<@NonNull V> keyHolder, @NonNull Supplier<V> supplier)
      Returns the value associated with the given keyHolder if it exists, or else the value supplied by the given supplier
      Type Parameters:
      V - the type of the value
      Parameters:
      keyHolder - the holder of the key
      supplier - supplier of the default value
      Returns:
      the value
    • get

      default <V extends @NonNull Object> V get(@NonNull CloudKey<V> key)
      Returns the value associated with the given key or fails exceptionally if it's missing.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      Returns:
      the value
      Throws:
      NullPointerException - if the value is missing
    • get

      default <V extends @NonNull Object> V get(@NonNull String key)
      Returns the value associated with the given key or fails exceptionally if it's missing.
      Type Parameters:
      V - the type of the value
      Parameters:
      key - the key
      Returns:
      the value
      Throws:
      NullPointerException - if the value is missing
    • get

      default <V extends @NonNull Object> V get(@NonNull CloudKeyHolder<V> keyHolder)
      Returns the value associated with the given keyHolder or fails exceptionally if it's missing.
      Type Parameters:
      V - the type of the value
      Parameters:
      keyHolder - the holder of the key
      Returns:
      the value
      Throws:
      NullPointerException - if the value is missing
    • contains

      boolean contains(@NonNull CloudKey<?> key)
      Returns whether the registry contains a value associated with the given key.
      Parameters:
      key - the key
      Returns:
      true if the value exists, or false if it does not
    • contains

      default boolean contains(@NonNull String key)
      Returns whether the registry contains a value associated with the given key.
      Parameters:
      key - the key
      Returns:
      true if the value exists, or false if it does not
    • contains

      default boolean contains(@NonNull CloudKeyHolder<?> keyHolder)
      Returns whether the registry contains a value associated with the given keyHolder.
      Parameters:
      keyHolder - the holder of the key
      Returns:
      true if the value exists, or false if it does not
    • all

      @NonNull Map<CloudKey<?>,? extends @NonNull Object> all()
      Returns all stored values.
      Returns:
      immutable view of all values