Class CollectionConfigValue<V,C extends Collection<V>,SELF extends CollectionConfigValue<V,C,SELF>>

Type Parameters:
V - Value type
C - Collection type
SELF - Self reference type (used for internal call or recursive generics)
All Implemented Interfaces:
Iterable<V>, Collection<V>
Direct Known Subclasses:
ConfiguredList

public abstract class CollectionConfigValue<V,C extends Collection<V>,SELF extends CollectionConfigValue<V,C,SELF>> extends CachedConfigValue<C,V> implements Collection<V>
Base implementation of a collection config value, like List or Set.
  • Field Details

    • constructor

      @NotNull protected final @NotNull Supplier<? extends C extends Collection<V>> constructor
    • paramAdapter

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

    • CollectionConfigValue

      public CollectionConfigValue(@NotNull @NotNull ValueManifest<C,V> manifest, @NotNull @NotNull Supplier<? extends C> constructor, @NotNull @NotNull ValueAdapter<V> paramAdapter)
  • Method Details

    • 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 C 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<C extends Collection<V>,V>
      Returns:
      Configured value
    • set

      public void set(@Nullable C collection)
      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<C extends Collection<V>,V>
      Parameters:
      collection - The value to set
    • copy

      @NotNull public C copy()
    • self

      @NotNull public abstract SELF self()
    • handle

      @NotNull public <T> T handle(Function<C,T> function)
    • modify

      @NotNull public SELF modify(Consumer<C> consumer)
    • size

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

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

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<V>
    • iterator

      @NotNull public @NotNull Iterator<V> iterator()
      Specified by:
      iterator in interface Collection<V>
      Specified by:
      iterator in interface Iterable<V>
    • toArray

      @NotNull public @NotNull Object @NotNull [] toArray()
      Specified by:
      toArray in interface Collection<V>
    • toArray

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

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

      public boolean add(V v)
      Specified by:
      add in interface Collection<V>
    • addAll

      public boolean addAll(@NotNull @NotNull Collection<? extends V> c)
      Specified by:
      addAll in interface Collection<V>
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<V>
    • removeAll

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

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

      public void clear()
      Specified by:
      clear in interface Collection<V>