public interface CommentedFileConfig extends ConcurrentCommentedConfig, FileConfig
A CommentedFileConfig is simply a FileConfig that implements CommentedConfig
(and provides some methods of ConcurrentCommentedConfig).
Please refer to the documentation of FileConfig for more information.
CommentedConfig.EntryUnmodifiableCommentedConfig.CommentNode| Modifier and Type | Method and Description |
|---|---|
static CommentedFileConfigBuilder |
builder(java.io.File file)
Returns a CommentedFileConfigBuilder to create a CommentedFileConfig with many options.
|
static CommentedFileConfigBuilder |
builder(java.io.File file,
ConfigFormat<? extends CommentedConfig> format)
Returns a CommentedFileConfigBuilder to create a CommentedFileConfig with many options.
|
static CommentedFileConfigBuilder |
builder(java.nio.file.Path file)
Returns a CommentedFileConfigBuilder to create a CommentedFileConfig with many options.
|
static CommentedFileConfigBuilder |
builder(java.nio.file.Path file,
ConfigFormat<? extends CommentedConfig> format)
Returns a CommentedFileConfigBuilder to create a CommentedFileConfig with many options.
|
static CommentedFileConfigBuilder |
builder(java.lang.String filePath)
Returns a CommentedFileConfigBuilder to create a CommentedFileConfig with many options.
|
static CommentedFileConfigBuilder |
builder(java.lang.String filePath,
ConfigFormat<? extends CommentedConfig> format)
Returns a CommentedFileConfigBuilder to create a CommentedFileConfig with many options.
|
default void |
bulkCommentedUpdate(java.util.function.Consumer<? super CommentedConfig> action)
Performs multiple read/write operations, and do not save the configuration until the end
(unless
save() is called by action). |
<R> R |
bulkCommentedUpdate(java.util.function.Function<? super CommentedConfig,R> action)
Performs multiple read/write operations, and do not save the configuration until the end
(unless
save() is called by action). |
default <R> R |
bulkUpdate(java.util.function.Function<? super Config,R> action)
Performs multiple reads and writes as a single atomic operation and returns a value.
|
default CommentedFileConfig |
checked()
Returns a checked view of the config.
|
static CommentedFileConfig |
of(java.io.File file)
Creates a new FileConfig based on the specified file and format.
|
static CommentedFileConfig |
of(java.io.File file,
ConfigFormat<? extends CommentedConfig> format)
Creates a new FileConfig based on the specified file and format.
|
static CommentedFileConfig |
of(java.nio.file.Path file)
Creates a new FileConfig based on the specified file and format.
|
static CommentedFileConfig |
of(java.nio.file.Path file,
ConfigFormat<? extends CommentedConfig> format)
Creates a new FileConfig based on the specified file and format.
|
static CommentedFileConfig |
of(java.lang.String filePath)
Creates a new FileConfig based on the specified file and format.
|
static CommentedFileConfig |
of(java.lang.String filePath,
ConfigFormat<? extends CommentedConfig> format)
Creates a new FileConfig based on the specified file and format.
|
static CommentedFileConfig |
ofConcurrent(java.io.File file)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static CommentedFileConfig |
ofConcurrent(java.io.File file,
ConfigFormat<? extends CommentedConfig> format)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static CommentedFileConfig |
ofConcurrent(java.nio.file.Path file)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static CommentedFileConfig |
ofConcurrent(java.nio.file.Path file,
ConfigFormat<? extends CommentedConfig> format)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static CommentedFileConfig |
ofConcurrent(java.lang.String filePath)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static CommentedFileConfig |
ofConcurrent(java.lang.String filePath,
ConfigFormat<? extends CommentedConfig> format)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
bulkCommentedRead, bulkCommentedRead, bulkRead, createSubConfigclearComments, commentMap, concurrentCopy, concurrentCopy, concurrentCopy, concurrentCopy, copy, copy, copy, copy, copy, copy, copy, copy, entrySet, fake, inMemory, inMemoryConcurrent, of, of, ofConcurrent, putAllComments, putAllComments, removeComment, removeComment, setComment, setComment, unmodifiable, wrapcontainsComment, containsComment, fake, getComment, getComment, getComments, getComments, getOptionalComment, getOptionalCommentbuilder, builder, builder, bulkUpdate, close, getFile, getNioPath, load, of, of, of, ofConcurrent, ofConcurrent, ofConcurrent, savebulkReadadd, add, addAll, clear, getDefaultMapCreator, getDefaultMapCreator, inMemoryUniversal, inMemoryUniversalConcurrent, isInsertionOrderPreserved, of, of, ofConcurrent, putAll, remove, remove, removeAll, set, set, setInsertionOrderPreserved, update, update, valueMapapply, apply, configFormat, contains, contains, get, get, getByte, getByte, getByteOrElse, getByteOrElse, getChar, getChar, getCharOrElse, getCharOrElse, getEnum, getEnum, getEnum, getEnum, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getInt, getInt, getIntOrElse, getIntOrElse, getIntOrElse, getIntOrElse, getLong, getLong, getLongOrElse, getLongOrElse, getLongOrElse, getLongOrElse, getOptional, getOptional, getOptionalEnum, getOptionalEnum, getOptionalEnum, getOptionalEnum, getOptionalInt, getOptionalInt, getOptionalLong, getOptionalLong, getOrElse, getOrElse, getOrElse, getOrElse, getRaw, getRaw, getShort, getShort, getShortOrElse, getShortOrElse, isEmpty, isNull, isNull, sizedefault CommentedFileConfig checked()
ConfigConfigFormat.supportsType(Class)
method. Trying to insert an unsupported value throws an IllegalArgumentException.
The values that are in the config when this method is called are also checked.
checked in interface CommentedConfigchecked in interface Configchecked in interface FileConfig<R> R bulkCommentedUpdate(java.util.function.Function<? super CommentedConfig,R> action)
save() is called by action).
This is a way of manually grouping config modifications together.
If this configuration automatically saves, it will not do so before the end of the bulkUpdate.
bulkCommentedUpdate in interface ConcurrentCommentedConfigR - the type of the function's resultaction - a function to execute on the configuration viewdefault void bulkCommentedUpdate(java.util.function.Consumer<? super CommentedConfig> action)
save() is called by action).
This is a way of manually grouping config modifications together.
If this configuration automatically saves, it will not do so before the end of the bulkUpdate.
bulkCommentedUpdate in interface ConcurrentCommentedConfigaction - a function to execute on the configuration viewdefault <R> R bulkUpdate(java.util.function.Function<? super Config,R> action)
ConcurrentConfigIt is guaranteed that the content of the config, accessed through the provided "view", will not be concurrently modified by other threads during the entire bulk operation. The configuration must be used exclusively through the object passed to the consumer (the "view"), not with the original reference. After the bulk operation, the view cannot be used anymore.
Here is an example:
String combined = config.bulkUpdate(conf -> {
String a = conf.get("a");
String b = conf.get("b");
String combined = a + b;
conf.set("combined", combined);
return combined;
// note that we use `conf` and not `config`!
});
If you only have to read the configuration, prefer to use ConcurrentConfig.bulkRead(Function),
since it may provide a better performance.
bulkUpdate in interface ConcurrentCommentedConfigbulkUpdate in interface ConcurrentConfigbulkUpdate in interface FileConfigR - the type of the function's resultaction - a function to execute on the configuration viewstatic CommentedFileConfig of(java.io.File file)
of in interface FileConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection failsbuilder(File)static CommentedFileConfig of(java.io.File file, ConfigFormat<? extends CommentedConfig> format)
file - the file to use to save and load the configformat - the config's formatbuilder(File, ConfigFormat)static CommentedFileConfig of(java.nio.file.Path file)
of in interface FileConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection failsbuilder(Path)static CommentedFileConfig of(java.nio.file.Path file, ConfigFormat<? extends CommentedConfig> format)
file - the file to use to save and load the configformat - the config's formatbuilder(Path, ConfigFormat)static CommentedFileConfig of(java.lang.String filePath)
of in interface FileConfigfilePath - the file's pathNoFormatFoundException - if the format detection failsbuilder(String)static CommentedFileConfig of(java.lang.String filePath, ConfigFormat<? extends CommentedConfig> format)
filePath - the file's pathformat - the config's formatbuilder(String, ConfigFormat)@Deprecated static CommentedFileConfig ofConcurrent(java.io.File file)
ConcurrentConfigofConcurrent in interface FileConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection fails@Deprecated static CommentedFileConfig ofConcurrent(java.io.File file, ConfigFormat<? extends CommentedConfig> format)
ConcurrentConfigfile - the file to use to save and load the configformat - the config's format@Deprecated static CommentedFileConfig ofConcurrent(java.nio.file.Path file)
ConcurrentConfigofConcurrent in interface FileConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection fails@Deprecated static CommentedFileConfig ofConcurrent(java.nio.file.Path file, ConfigFormat<? extends CommentedConfig> format)
ConcurrentConfigfile - the file to use to save and load the configformat - the config's format@Deprecated static CommentedFileConfig ofConcurrent(java.lang.String filePath, ConfigFormat<? extends CommentedConfig> format)
ConcurrentConfigfilePath - the file's pathformat - the config's format@Deprecated static CommentedFileConfig ofConcurrent(java.lang.String filePath)
ConcurrentConfigofConcurrent in interface FileConfigfilePath - the file's pathNoFormatFoundException - if the format detection failsstatic CommentedFileConfigBuilder builder(java.io.File file, ConfigFormat<? extends CommentedConfig> format)
file - the file to use to save and load the configformat - the config's formatstatic CommentedFileConfigBuilder builder(java.io.File file)
builder in interface FileConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection failsFileConfigBuilderstatic CommentedFileConfigBuilder builder(java.nio.file.Path file, ConfigFormat<? extends CommentedConfig> format)
file - the file to use to save and load the configformat - the config's formatstatic CommentedFileConfigBuilder builder(java.nio.file.Path file)
builder in interface FileConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection failsFileConfigBuilderstatic CommentedFileConfigBuilder builder(java.lang.String filePath)
builder in interface FileConfigfilePath - the file's pathNoFormatFoundException - if the format detection failsFileConfigBuilderstatic CommentedFileConfigBuilder builder(java.lang.String filePath, ConfigFormat<? extends CommentedConfig> format)
filePath - the file's pathformat - the config's format