Class ConfiguredList<V>

  • All Implemented Interfaces:
    java.lang.Iterable<V>, java.util.Collection<V>, java.util.List<V>

    public class ConfiguredList<V>
    extends CachedConfigValue<java.util.List<V>>
    implements java.util.List<V>
    • Field Detail

      • constructor

        @NotNull
        protected final @NotNull java.util.function.Supplier<? extends java.util.List<V>> constructor
      • paramAdapter

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

      • ConfiguredList

        public ConfiguredList​(@NotNull
                              @NotNull ValueManifest<java.util.List<V>> manifest,
                              @NotNull
                              @NotNull java.util.function.Supplier<? extends java.util.List<V>> constructor,
                              @NotNull
                              @NotNull ValueAdapter<V> paramAdapter)
    • Method Detail

      • builderOf

        @NotNull
        public static <T> @NotNull ConfigListBuilder<T> builderOf​(@NotNull
                                                                  @NotNull java.lang.Class<T> type)
      • adapter

        @NotNull
        public @NotNull ValueAdapter<V> adapter()
        Returns:
        Adapter of this value.
      • paramType

        @NotNull
        public @NotNull ValueType<V> paramType()
      • parser

        @Nullable
        public @Nullable ValueParser<V> parser()
        Returns:
        Value's parser, parse base object to value.
      • serializer

        @Nullable
        public @Nullable ValueSerializer<V> serializer()
        Returns:
        Value's serializer, parse value to base object.
      • get

        @NotNull
        public @NotNull java.util.List<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.List<V>>
        Returns:
        Configured value
      • set

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

        public V get​(int index)
        Specified by:
        get in interface java.util.List<V>
      • copy

        @NotNull
        public @NotNull java.util.List<V> copy()
      • handle

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

        @NotNull
        public @NotNull ConfiguredList<V> modify​(java.util.function.Consumer<java.util.List<V>> consumer)
      • set

        public V set​(int index,
                     V element)
        Specified by:
        set in interface java.util.List<V>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<V>
        Specified by:
        size in interface java.util.List<V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<V>
        Specified by:
        isEmpty in interface java.util.List<V>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<V>
        Specified by:
        contains in interface java.util.List<V>
      • iterator

        @NotNull
        public @NotNull java.util.Iterator<V> iterator()
        Specified by:
        iterator in interface java.util.Collection<V>
        Specified by:
        iterator in interface java.lang.Iterable<V>
        Specified by:
        iterator in interface java.util.List<V>
      • toArray

        @NotNull
        public @NotNull java.lang.Object @NotNull [] toArray()
        Specified by:
        toArray in interface java.util.Collection<V>
        Specified by:
        toArray in interface java.util.List<V>
      • toArray

        @NotNull
        public <T> @NotNull T @NotNull [] toArray​(@NotNull
                                                  @NotNull T[] a)
        Specified by:
        toArray in interface java.util.Collection<V>
        Specified by:
        toArray in interface java.util.List<V>
      • containsAll

        public boolean containsAll​(@NotNull
                                   @NotNull java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<V>
        Specified by:
        containsAll in interface java.util.List<V>
      • add

        public boolean add​(V v)
        Specified by:
        add in interface java.util.Collection<V>
        Specified by:
        add in interface java.util.List<V>
      • add

        public void add​(int index,
                        V element)
        Specified by:
        add in interface java.util.List<V>
      • addAll

        public boolean addAll​(@NotNull
                              @NotNull java.util.Collection<? extends V> c)
        Specified by:
        addAll in interface java.util.Collection<V>
        Specified by:
        addAll in interface java.util.List<V>
      • addAll

        public boolean addAll​(int index,
                              @NotNull
                              @NotNull java.util.Collection<? extends V> c)
        Specified by:
        addAll in interface java.util.List<V>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<V>
        Specified by:
        remove in interface java.util.List<V>
      • remove

        public V remove​(int index)
        Specified by:
        remove in interface java.util.List<V>
      • removeAll

        public boolean removeAll​(@NotNull
                                 @NotNull java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<V>
        Specified by:
        removeAll in interface java.util.List<V>
      • retainAll

        public boolean retainAll​(@NotNull
                                 @NotNull java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<V>
        Specified by:
        retainAll in interface java.util.List<V>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<V>
        Specified by:
        clear in interface java.util.List<V>
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<V>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<V>
      • listIterator

        @NotNull
        public @NotNull java.util.ListIterator<V> listIterator()
        Specified by:
        listIterator in interface java.util.List<V>
      • listIterator

        @NotNull
        public @NotNull java.util.ListIterator<V> listIterator​(int index)
        Specified by:
        listIterator in interface java.util.List<V>
      • subList

        @NotNull
        public @NotNull java.util.List<V> subList​(int fromIndex,
                                                  int toIndex)
        Specified by:
        subList in interface java.util.List<V>