Class ConfiguredList<V>
- java.lang.Object
-
- cc.carm.lib.configuration.value.ValueManifest<T>
-
- cc.carm.lib.configuration.value.ConfigValue<T>
-
- cc.carm.lib.configuration.value.impl.CachedConfigValue<java.util.List<V>>
-
- cc.carm.lib.configuration.value.standard.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 Summary
Fields Modifier and Type Field Description protected @NotNull java.util.function.Supplier<? extends java.util.List<V>>
constructor
protected @NotNull ValueAdapter<V>
paramAdapter
-
Fields inherited from class cc.carm.lib.configuration.value.impl.CachedConfigValue
cachedValue, parsedTime
-
Fields inherited from class cc.carm.lib.configuration.value.ValueManifest
defaultSupplier, holder, initializer, path, type
-
-
Constructor Summary
Constructors Constructor Description ConfiguredList(@NotNull ValueManifest<java.util.List<V>> manifest, @NotNull java.util.function.Supplier<? extends java.util.List<V>> constructor, @NotNull ValueAdapter<V> paramAdapter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ValueAdapter<V>
adapter()
void
add(int index, V element)
boolean
add(V v)
boolean
addAll(int index, @NotNull java.util.Collection<? extends V> c)
boolean
addAll(@NotNull java.util.Collection<? extends V> c)
static <T> @NotNull ConfigListBuilder<T>
builderOf(@NotNull ValueType<T> type)
static <T> @NotNull ConfigListBuilder<T>
builderOf(@NotNull java.lang.Class<T> type)
void
clear()
boolean
contains(java.lang.Object o)
boolean
containsAll(@NotNull java.util.Collection<?> c)
@NotNull java.util.List<V>
copy()
@NotNull java.util.List<V>
get()
Gets the configured value (i.e., the value read from the source).V
get(int index)
<T> T
handle(java.util.function.Function<java.util.List<V>,T> function)
int
indexOf(java.lang.Object o)
boolean
isEmpty()
@NotNull java.util.Iterator<V>
iterator()
int
lastIndexOf(java.lang.Object o)
@NotNull java.util.ListIterator<V>
listIterator()
@NotNull java.util.ListIterator<V>
listIterator(int index)
@NotNull ConfiguredList<V>
modify(java.util.function.Consumer<java.util.List<V>> consumer)
@NotNull ValueType<V>
paramType()
@Nullable ValueParser<V>
parser()
V
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(@NotNull java.util.Collection<?> c)
boolean
retainAll(@NotNull java.util.Collection<?> c)
@Nullable ValueSerializer<V>
serializer()
V
set(int index, V element)
void
set(@Nullable java.util.List<V> value)
Sets the value of this configuration.int
size()
@NotNull java.util.List<V>
subList(int fromIndex, int toIndex)
@NotNull java.lang.Object @NotNull []
toArray()
<T> @NotNull T @NotNull []
toArray(@NotNull T[] a)
-
Methods inherited from class cc.carm.lib.configuration.value.impl.CachedConfigValue
cacheExpired, getCachedOrDefault, getCachedOrDefault, getCachedValue, getDefaultFirst, parserFor, serializerFor, updateCache
-
Methods inherited from class cc.carm.lib.configuration.value.ConfigValue
getNotNull, getOrDefault, isDefault, optional, resolve, save, setDefault, setDefault
-
Methods inherited from class cc.carm.lib.configuration.value.ValueManifest
config, defaults, defaults, defaults, getData, hasDefaults, holder, holder, initialize, initialize, metadata, path, path, setData, type
-
-
-
-
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)
-
builderOf
@NotNull public static <T> @NotNull ConfigListBuilder<T> builderOf(@NotNull @NotNull ValueType<T> type)
-
adapter
@NotNull public @NotNull ValueAdapter<V> adapter()
- Returns:
- Adapter of this value.
-
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 theConfigValue.getOrDefault()
method to obtain the default value when this value is empty.- Specified by:
get
in classConfigValue<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, callConfigurationHolder.save()
.- Specified by:
set
in classConfigValue<java.util.List<V>>
- Parameters:
value
- The value to set
-
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)
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(java.lang.Object o)
-
iterator
@NotNull public @NotNull java.util.Iterator<V> iterator()
-
toArray
@NotNull public @NotNull java.lang.Object @NotNull [] toArray()
-
toArray
@NotNull public <T> @NotNull T @NotNull [] toArray(@NotNull @NotNull T[] a)
-
containsAll
public boolean containsAll(@NotNull @NotNull java.util.Collection<?> c)
-
add
public boolean add(V v)
-
addAll
public boolean addAll(@NotNull @NotNull java.util.Collection<? extends V> c)
-
addAll
public boolean addAll(int index, @NotNull @NotNull java.util.Collection<? extends V> c)
- Specified by:
addAll
in interfacejava.util.List<V>
-
remove
public boolean remove(java.lang.Object o)
-
removeAll
public boolean removeAll(@NotNull @NotNull java.util.Collection<?> c)
-
retainAll
public boolean retainAll(@NotNull @NotNull java.util.Collection<?> c)
-
clear
public void clear()
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<V>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<V>
-
listIterator
@NotNull public @NotNull java.util.ListIterator<V> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<V>
-
listIterator
@NotNull public @NotNull java.util.ListIterator<V> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<V>
-
-