Class ConfiguredMap<K,V>

All Implemented Interfaces:
Map<K,V>

public class ConfiguredMap<K,V> extends CachedConfigValue<Map<K,V>,V> implements Map<K,V>
  • Field Details

    • constructor

      @NotNull protected final @NotNull Supplier<? extends Map<K,V>> constructor
    • keyAdapter

      @NotNull protected final @NotNull ValueAdapter<K> keyAdapter
    • valueAdapter

      @NotNull protected final @NotNull ValueAdapter<V> valueAdapter
  • Constructor Details

  • Method Details

    • builderOf

      public static <V> ConfigMapCreator<String,V> builderOf(@NotNull @NotNull Class<V> valueType)
    • builderOf

      public static <K, V> ConfigMapCreator<K,V> builderOf(@NotNull @NotNull ValueType<K> keyType, @NotNull @NotNull ValueType<V> valueType)
    • builderOf

      public static <K, V> ConfigMapCreator<K,V> builderOf(@NotNull @NotNull Class<K> keyType, @NotNull @NotNull Class<V> valueType)
    • of

      public static <K, V> ConfiguredMap<K,V> of(@NotNull @NotNull Supplier<? extends Map<K,V>> constructor, @NotNull @NotNull ValueAdapter<K> keyAdapter, @NotNull @NotNull ValueAdapter<V> valueAdapter)
    • keyAdapter

      @NotNull public @NotNull ValueAdapter<K> keyAdapter()
    • keyType

      @NotNull public @NotNull ValueType<K> keyType()
    • valueAdapter

      @NotNull public @NotNull ValueAdapter<V> valueAdapter()
    • valueType

      @NotNull public @NotNull ValueType<V> valueType()
    • get

      @NotNull public @NotNull Map<K,V> get()
      Description copied from class: ConfigValue
      Gets the configured value (i.e., the value read from the source).
      If no default value was written during initialization, you can use the ConfigValue.getOrDefault() method to obtain the default value when this value is empty.
      Specified by:
      get in class ConfigValue<Map<K,V>,V>
      Returns:
      Configured value
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
    • getNotNull

      public V getNotNull(@Nullable K key)
    • set

      public void set(@Nullable @Nullable Map<K,V> value)
      Description copied from class: ConfigValue
      Sets the value of this configuration.
      After setting, the configuration file will NOT be saved automatically. To save, call ConfigurationHolder.save().
      Specified by:
      set in class ConfigValue<Map<K,V>,V>
      Parameters:
      value - The value to set
    • handle

      @NotNull public <T> T handle(Function<Map<K,V>,T> function)
    • modify

      @NotNull public @NotNull ConfiguredMap<K,V> modify(Consumer<Map<K,V>> consumer)
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<K,V>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<K,V>
    • put

      @Nullable public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
    • putAll

      public void putAll(@NotNull @NotNull Map<? extends K,? extends V> m)
      Specified by:
      putAll in interface Map<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • keySet

      @NotNull public @NotNull Set<K> keySet()
      Specified by:
      keySet in interface Map<K,V>
    • values

      @NotNull public @NotNull Collection<V> values()
      Specified by:
      values in interface Map<K,V>
    • entrySet

      @NotNull public @NotNull @Unmodifiable Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>