Class CollectionConfigValue<V,C extends Collection<V>,SELF extends CollectionConfigValue<V,C,SELF>>
java.lang.Object
cc.carm.lib.configuration.value.ValueManifest<C,V>
cc.carm.lib.configuration.value.ConfigValue<C,V>
cc.carm.lib.configuration.value.impl.CachedConfigValue<C,V>
cc.carm.lib.configuration.value.impl.CollectionConfigValue<V,C,SELF>
- Type Parameters:
V
- Value typeC
- Collection typeSELF
- 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>
-
Field Summary
FieldsFields 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, validator
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionConfigValue
(@NotNull ValueManifest<C, V> manifest, @NotNull Supplier<? extends C> constructor, @NotNull ValueAdapter<V> paramAdapter) -
Method Summary
Modifier and TypeMethodDescription@NotNull ValueAdapter
<V> adapter()
boolean
boolean
addAll
(@NotNull Collection<? extends V> c) void
clear()
boolean
boolean
containsAll
(@NotNull Collection<?> c) copy()
get()
Gets the configured value (i.e., the value read from the source).<T> T
boolean
isEmpty()
iterator()
@Nullable ValueParser
<V> parser()
boolean
boolean
removeAll
(@NotNull Collection<?> c) boolean
retainAll
(@NotNull Collection<?> c) abstract SELF
self()
@Nullable ValueSerializer
<V> void
Sets the value of this configuration.int
size()
@NotNull Object @NotNull []
toArray()
<T> T @NotNull []
toArray
(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, getOr, 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, throwing, throwing, type, validate, validator, validator, withValidated
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
constructor
-
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
- Returns:
- Adapter of this value.
-
paramType
-
parser
- Returns:
- Value's parser, parse base object to value.
-
serializer
- Returns:
- Value's serializer, parse value to base object.
-
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<C extends Collection<V>,
V> - Returns:
- Configured value
-
set
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<C extends Collection<V>,
V> - Parameters:
collection
- The value to set
-
copy
-
self
-
handle
-
modify
-
size
public int size()- Specified by:
size
in interfaceCollection<V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<V>
-
contains
- Specified by:
contains
in interfaceCollection<V>
-
iterator
-
toArray
- Specified by:
toArray
in interfaceCollection<V>
-
toArray
@NotNull public <T> T @NotNull [] toArray(@NotNull T[] a) - Specified by:
toArray
in interfaceCollection<V>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<V>
-
add
- Specified by:
add
in interfaceCollection<V>
-
addAll
- Specified by:
addAll
in interfaceCollection<V>
-
remove
- Specified by:
remove
in interfaceCollection<V>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<V>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<V>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<V>
-