Releases: TheElectronWill/night-config
3.6.4!
3.6 bugfix release
3.6 bugfix release
See #71 😃
Insertion order preservation support for FileConfigBuilder and ConfigFormat
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.
Breaking change if you implement your own ConfigFormat (for advanced users)
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.
I don't implement my own ConfigFormat, what happens to me? (for normal users)
If you don't implement your own ConfigFormat then everything is fine! Just enjoy the new features. 😃
Supports preserving the insertion order of config values
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 #61
Unlike wrapping a LinkedHashMap
, these two new possibilities also work with nested configs.
Hocon improvements and toml bugfixes
v3.5.2 TomlParser: Remove superfluous call to trimmedView()
NightConfig v3.5.1 - I would like to write enums please!
Fix writing of enum values for TOML and JSON languages.
NightConfig v3.5.0 - Enum support
Enum support
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);
Bugfixes
The following bugs have been fixed:
NightConfig v3.4.2 - Boosted ObjectConverter
Boosted ObjectConverter
ObjectConverter now
- converts the superclass fields too (see #48)
- supports all types of
Collection
, not just lists - handles generic nested collections, like
LinkedList<Collection<List<Optional<SomeObject>>>>
(see #47)
These improvements are also available to the android modules.
Other improvements include
- Tests rewritten with JUnit instead of ifs and Java asserts
- A few mistakes have been fixed
NightConfig v3.4.1 - better android support
- Special android modules which don't use
java.nio.file
norjava.util.function
in order to be compatible with old versions of Android (i.e. below api level 26). - Fix charset parameter in ConfigParser: the parameter was ignored, it now works properly