Class ConfiguredMap<K,​V>

  • All Implemented Interfaces:
    java.util.Map<K,​V>

    public class ConfiguredMap<K,​V>
    extends CachedConfigValue<java.util.Map<K,​V>>
    implements java.util.Map<K,​V>
    • Field Detail

      • constructor

        @NotNull
        protected final @NotNull java.util.function.Supplier<? extends java.util.Map<K,​V>> constructor
      • keyAdapter

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

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

      • ConfiguredMap

        public ConfiguredMap​(@NotNull
                             @NotNull ValueManifest<java.util.Map<K,​V>> manifest,
                             @NotNull
                             @NotNull java.util.function.Supplier<? extends java.util.Map<K,​V>> constructor,
                             @NotNull
                             @NotNull ValueAdapter<K> keyAdapter,
                             @NotNull
                             @NotNull ValueAdapter<V> valueAdapter)
    • Method Detail

      • builderOf

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

        public static <K,​V> ConfiguredMap<K,​V> of​(@NotNull
                                                              @NotNull java.util.function.Supplier<? extends java.util.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 java.util.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<java.util.Map<K,​V>>
        Returns:
        Configured value
      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<K,​V>
      • getNotNull

        public V getNotNull​(@Nullable
                            K key)
      • set

        public void set​(@Nullable
                        @Nullable java.util.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<java.util.Map<K,​V>>
        Parameters:
        value - The value to set
      • handle

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

        @NotNull
        public @NotNull ConfiguredMap<K,​V> modify​(java.util.function.Consumer<java.util.Map<K,​V>> consumer)
      • size

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

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

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

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

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

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<K,​V>
      • putAll

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

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

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

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

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