public interface FileConfig extends Config, java.lang.AutoCloseable
Config.Entry| Modifier and Type | Method and Description |
|---|---|
static FileConfigBuilder |
builder(java.io.File file)
Returns a FileConfigBuilder to create a FileConfig with many options.
|
static FileConfigBuilder |
builder(java.io.File file,
ConfigFormat<?> format)
Returns a FileConfigBuilder to create a FileConfig with many options.
|
static FileConfigBuilder |
builder(java.nio.file.Path file)
Returns a FileConfigBuilder to create a FileConfig with many options.
|
static FileConfigBuilder |
builder(java.nio.file.Path file,
ConfigFormat<?> format)
Returns a FileConfigBuilder to create a FileConfig with many options.
|
static FileConfigBuilder |
builder(java.lang.String filePath)
Returns a FileConfigBuilder to create a FileConfig with many options.
|
static FileConfigBuilder |
builder(java.lang.String filePath,
ConfigFormat<?> format)
Returns a FileConfigBuilder to create a FileConfig with many options.
|
default void |
bulkUpdate(java.util.function.Consumer<? super Config> action)
Performs multiple read/write operations, and do not save the configuration until the end
(unless
save() is called by action). |
<R> R |
bulkUpdate(java.util.function.Function<? super Config,R> action)
Performs multiple read/write operations, and do not save the configuration until the end
(unless
save() is called by action). |
default FileConfig |
checked()
Returns a checked view of the config.
|
void |
close()
Closes this FileConfig, releases its associated resources (if any), and ensure that the
ongoing saving operations complete.
|
java.io.File |
getFile() |
java.nio.file.Path |
getNioPath() |
void |
load()
(Re)loads this config from the file.
|
static FileConfig |
of(java.io.File file)
Creates a new FileConfig based on the specified file.
|
static FileConfig |
of(java.io.File file,
ConfigFormat<? extends Config> format)
Creates a new FileConfig based on the specified file and format.
|
static FileConfig |
of(java.nio.file.Path file)
Creates a new FileConfig based on the specified file.
|
static FileConfig |
of(java.nio.file.Path file,
ConfigFormat<? extends Config> format)
Creates a new FileConfig based on the specified file and format.
|
static FileConfig |
of(java.lang.String filePath)
Creates a new FileConfig based on the specified file.
|
static FileConfig |
of(java.lang.String filePath,
ConfigFormat<?> format)
Creates a new FileConfig based on the specified file and format.
|
static FileConfig |
ofConcurrent(java.io.File file)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static FileConfig |
ofConcurrent(java.io.File file,
ConfigFormat<?> format)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static FileConfig |
ofConcurrent(java.nio.file.Path file)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static FileConfig |
ofConcurrent(java.nio.file.Path file,
ConfigFormat<?> format)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static FileConfig |
ofConcurrent(java.lang.String filePath)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
static FileConfig |
ofConcurrent(java.lang.String filePath,
ConfigFormat<?> format)
Deprecated.
All FileConfig are now thread-safe by default, backed by a
ConcurrentConfig |
void |
save()
Saves this config as soon as possible.
|
add, add, addAll, clear, concurrentCopy, concurrentCopy, copy, copy, copy, copy, createSubConfig, entrySet, getDefaultMapCreator, getDefaultMapCreator, inMemory, inMemoryConcurrent, inMemoryUniversal, inMemoryUniversalConcurrent, isInsertionOrderPreserved, of, of, ofConcurrent, putAll, remove, remove, removeAll, set, set, setInsertionOrderPreserved, unmodifiable, update, update, valueMap, wrapapply, 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, sizejava.io.File getFile()
java.nio.file.Path getNioPath()
void save()
void load()
void close()
A closed FileConfig can still be used via the Config's methods, but save() and
load() will throw an IllegalStateException. Closing an aleady closed FileConfig has
no effect.
close in interface java.lang.AutoCloseabledefault FileConfig 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.
<R> R bulkUpdate(java.util.function.Function<? super Config,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.
default void bulkUpdate(java.util.function.Consumer<? super Config> 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.
static FileConfig of(java.io.File file)
file - the file to use to save and load the configNoFormatFoundException - if the format detection failsbuilder(File)static FileConfig of(java.io.File file, ConfigFormat<? extends Config> format)
file - the file to use to save and load the configformat - the config's formatbuilder(File, ConfigFormat)static FileConfig of(java.nio.file.Path file)
file - the file to use to save and load the configNoFormatFoundException - if the format detection failsbuilder(Path)static FileConfig of(java.nio.file.Path file, ConfigFormat<? extends Config> format)
file - the file to use to save and load the configformat - the config's formatbuilder(Path, ConfigFormat)static FileConfig of(java.lang.String filePath)
filePath - the file's pathNoFormatFoundException - if the format detection failsbuilder(String)static FileConfig of(java.lang.String filePath, ConfigFormat<?> format)
filePath - the file's pathformat - the config's formatbuilder(String, ConfigFormat)@Deprecated static FileConfig ofConcurrent(java.io.File file)
ConcurrentConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection fails@Deprecated static FileConfig ofConcurrent(java.io.File file, ConfigFormat<?> format)
ConcurrentConfigfile - the file to use to save and load the configformat - the config's format@Deprecated static FileConfig ofConcurrent(java.nio.file.Path file)
ConcurrentConfigfile - the file to use to save and load the configNoFormatFoundException - if the format detection fails@Deprecated static FileConfig ofConcurrent(java.nio.file.Path file, ConfigFormat<?> format)
ConcurrentConfigfile - the file to use to save and load the configformat - the config's format@Deprecated static FileConfig ofConcurrent(java.lang.String filePath)
ConcurrentConfigfilePath - the file's pathNoFormatFoundException - if the format detection fails@Deprecated static FileConfig ofConcurrent(java.lang.String filePath, ConfigFormat<?> format)
ConcurrentConfigfilePath - the file's pathformat - the config's formatstatic FileConfigBuilder builder(java.io.File file)
file - the file to use to save and load the configNoFormatFoundException - if the format detection failsFileConfigBuilderstatic FileConfigBuilder builder(java.io.File file, ConfigFormat<?> format)
file - the file to use to save and load the configformat - the config's formatFileConfigBuilderstatic FileConfigBuilder builder(java.nio.file.Path file)
file - the file to use to save and load the configNoFormatFoundException - if the format detection failsFileConfigBuilderstatic FileConfigBuilder builder(java.nio.file.Path file, ConfigFormat<?> format)
file - the file to use to save and load the configformat - the config's formatFileConfigBuilderstatic FileConfigBuilder builder(java.lang.String filePath)
filePath - the file's pathNoFormatFoundException - if the format detection failsFileConfigBuilderstatic FileConfigBuilder builder(java.lang.String filePath, ConfigFormat<?> format)
filePath - the file's pathformat - the config's formatFileConfigBuilder