Powerful java configuration library for toml, yaml, hocon, json and in-memory configurations. Serialization/deserialization framework.
LGPL-3.0 License
Bot releases are visible (Hide)
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.8.0...v3.8.1
Published by TheElectronWill 4 months ago
ConcurrentConfig
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.7.4...v3.8.0
Published by TheElectronWill 4 months ago
This minor release fixes a bug that caused the FileWatcher
to close when a directory containing watched files was deleted. Also, an exception is now raised early if the FileWatcher
is used in an unsupported manner.
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.7.3...v3.7.4
Published by TheElectronWill 4 months ago
This minor release fixes a bad interaction between AsyncFileConfig
and StampedConfig
, and between SyncFileConfig
, SynchronizedConfig
and TomlParser
, which resulted in some TOML configurations to be mis-loaded. Thanks to @Technici4n for discovering the bug!
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.7.2...v3.7.3
Published by TheElectronWill 5 months ago
The TOML implementation is now more robust thanks to toml-test. We don't call the binary, but rather include the repository as a Git submodule in order to grab all the test files.
Compatibility note: the TOML parser of NightConfig now rejects some files that it would have previously accepted (even though they were invalid). This is intended, and we encourage all users to fix their invalid TOML files.
Please read the release notes of v3.7.0 ✨ to learn what has changed since v3.6.x.
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.7.1...v3.7.2
Published by TheElectronWill 5 months ago
JsonParser
You should use v3.7.1 instead of v3.7.0.
Please read the release notes of v3.7.0 ✨ to learn what has changed since v3.6.x.
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.7.0...v3.7.1
Published by TheElectronWill 5 months ago
FileWatcher
now comes with out-of-the-box debouncing, which improves the performance of autoreloading and autosaving configurations ⚡, see https://github.com/TheElectronWill/night-config/pull/148
FileConfig
instances are now actually thread-safe and work better with autoreload, which should prevent most of the corruption issues 🛡️, see https://github.com/TheElectronWill/night-config/pull/152
serde
package 🚀, see https://github.com/TheElectronWill/night-config/pull/163.ObjectConverter
, the new ObjectSerializer
and ObjectDeserializer
are modular and extensible: you can register your own serializers and deserializers. Deserializers (config -> object) are chosen based on the generic type of the field to set and the type of the config value to deserialize. This allows for fine-grained deserialization. The old ObjectConverter
still works but is now deprecated. The goal is to remove the old conversion
package in version 4.0.0.conversion
package; the new serde
package supports multiple @SerdeAssert
conditions out of the box)serde
Deserializer, automatically apply some "risky" conversions (e.g. long -> int) when it is not lossy, close https://github.com/TheElectronWill/night-config/issues/119
Config
storage in ConfigSpec
, by @PaintNinja in https://github.com/TheElectronWill/night-config/pull/168
ObjectConverter
by @TheElectronWill in https://github.com/TheElectronWill/night-config/pull/163
NightConfig 3.7.0 is backward-compatible with previous releases, therefore I encourage you to upgrade your dependency on NightConfig in order to benefit from the new version.
Binary-wise, the backward-compatibility has been checked with japicmp
.
Source-wise, there is one small incompatible change: FileWatcher#addWatch
no longers throws an IOException
, which can result in a compiler error unreachable code
on the associated try/catch (example in forge).
Thank you everyone!
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.6.7...v3.7.0
Published by TheElectronWill about 1 year ago
More bug fixes :)
Full Changelog: https://github.com/TheElectronWill/night-config/compare/v3.6.6...v3.6.7
Published by TheElectronWill about 2 years ago
Fixes include: #101, #113
Published by TheElectronWill almost 3 years ago
Published by TheElectronWill about 3 years ago
Fix #87, fix #82
Published by TheElectronWill over 4 years ago
See #77
Published by TheElectronWill almost 5 years ago
See #71 😃
Published by TheElectronWill over 5 years ago
This release resolves the issue #62 by adding two methods to FileConfigBuilder:
preserveInsertionOrder()
backingMapCreator(Supplier<Map<String, Object>>)
And some other things around the backing map of configurations.
If you implement your own ConfigFormat
, please note that the interface now requires you to implement the new method createConfig(Supplier<Map<String, Object>>)
.
The two methods createConfig()
and createConcurrentConfig()
are now default
methods and don't need to be implemented. They both call createConfig(Supplier)
with the result of Config.getDefaultMapCreator(boolean)
.
You can read the detailed changes here.
If you don't implement your own ConfigFormat then everything is fine! Just enjoy the new features. 😃
Published by TheElectronWill over 5 years ago
You can now use the following code to make all new configurations preserve the insertion order of their values.
Config.setInsertionOrderPreserved(true)
You can also provide your own map supplier ("map creator") on a case-by-case basis. See PR https://github.com/TheElectronWill/Night-Config/pull/61
Unlike wrapping a LinkedHashMap
, these two new possibilities also work with nested configs.
Published by TheElectronWill over 5 years ago
Published by TheElectronWill over 5 years ago
Fix writing of enum values for TOML and JSON languages.
Published by TheElectronWill over 5 years ago
Enum values are now supported via the getEnum
methods which can convert strings and integers to enum values of the specified class.
config.set("key", MyEnum.A);
config.set("string", "A");
config.set("ordinal", 0);
MyEnum value = config.getEnum("key", MyEnum.class); // We could have used config.get("key") here
MyEnum valueByString = config.getEnum("string", MyEnum.class); // getEnum is necessary to convert the string to an Enum value
MyEnum valueByOrdinal = config.getEnum("ordinal", MyEnum.class, EnumGetMethod.ORDINAL_OR_NAME);
There exists variants of getOrElse
and getOptional
for enums :
MyEnum value = config.getEnumOrElse("key", MyEnum.B);
Optional<MyEnum> optionalValue = config.get("key", MyEnum.class);
The following bugs have been fixed:
Published by TheElectronWill almost 6 years ago
ObjectConverter now
Collection
, not just listsLinkedList<Collection<List<Optional<SomeObject>>>>
(see #47)These improvements are also available to the android modules.
Published by TheElectronWill about 6 years ago
java.nio.file
nor java.util.function
in order to be compatible with old versions of Android (i.e. below api level 26).