Releases: jdiazcano/cfg4k
Symbolic links
0.9.41
Bugfixes and test rework
This one is composed mostly by bugfixes and rework on how the tests are done and finally getting rid of Spek 1 which caused a lot of pain when trying to debug things, IDE exceptions etc...
Bugfixes:
- Fixed #57
- Fixed a bug where the equality of ConfigObjects wouldn't be true at some point
- Now values aren't going to be overridden when a property has a root and children at the same time, a warning will be shown (it was already showing a warning if the root was direct)
- Now nulls won't be cached in
getOrNull
inside aCachedConfigProvider
- Added support for lists inside properties objects. (CATCH: The order of the items in the list will be unpredictable, so don't rely on this if you need a sorted list)
Rework
Now instead of Spek 1, Kotlintest is being used (latest version). With this rework I had to think better how to test and increase the test coverage. Also every file has its test file equivalent which was not true before, basically everything was a Functional test!
More complex types and rework
In this release a huge rework of the source code has been done. Some methods have been removed and some have been added from the API.
- Now it supports all kind of complex objects and maps. Everything will be transformed for you (not supported in properties, system properties or environment variables as the process to parse that into a root ConfigObject can be different in each case, you can always implement your own loader to do this). Some examples:
List<List<Int>>
Map<String, Map<Int, List<String>>>
- The signature for the
Parser
has changed:context: ConfigContext, value: ConfigObject, typeStructure: TypeStructure
.
Now it will receive an object which is the context (similar to Gson for example), where you will be able to parse a subtype or a property from your complex object. A new object has been introduced which is theTypeStructure
this will hold the structure of the generic type of your object, for example fromList<List<Int>>
, the type structure will be this:- type: List<List> and generics: List
- type: List and generics: Int
- Removed methods from the
ConfigProvider
interface:get(name: String, type: Class<T>, default: T?): T
getOrNull(name: String, type: Class<T>, default: T?): T?
- Added data class support, now data classes will be instantiated like if they were interfaces but not giving back a proxy but an actual instance of the class.
Those two methods have been removed in favor of the same method with the change of type, type: Type
. These methods should be better used with the extension functions get<List<String>>()
as they will hide for you the work of transforming a generic into a Type
object.
S3, System and Environment as DCL
Now SystemPropertyConfigLoader
and EnvironmentConfigLoader
extends DefaultConfigLoader
so merges and binding will work with them.
There is one caveat, that is the SystemProperty actually has something like:
a=1
a.b=2
Which is perfectly viable in properties. But when translating that to an object it cannot be represented (for example you cannot do that in JSON). If that happens a warning will be emitted and it will only happen with a java property in the SystemPropertyConfigLoader (or if you do the wrong thing in a properties file)
More sources!
- Added sources for:
- Bitbucket
- Github
- String
- StringRotation (list of strings that will be rotated on reload)
- Revamped ByteBuddyBinder and now it holds a cache so classes won't be recompiled everytime
- Added merge to ConfigLoader so you can merge before adding it to a provider.
- Reusable TimedReloadStrategy
- Auth in URLConfigSource
- Code cleaning up
Complex lists
- Nos lists can contain complex objects and the library will handle them all
- Bugfixes and code improvements
Default binder and Override provider
- Now the default binder will be the ProxyBinder
- Now the OverrideConfigProvider takes a vararg of config providers instead of loaders. This makes the binding and reloadstrategy be separated in each provider so you can have a different streategy for each one. The problem was that you only had one reload strategy and for example a classpath resource file won't change so there is no need to reload them!
- Now the provider has a new method of "contains" to check if there is instead of checking null later on
Git, default values and parsers
- Added Git config loader
- Added parsers to deal with time and date
- Now the settings can be used with a default value, if there is no setting and no default value, an exception will be thrown.
- Minor code updates
YAML, Environment and System settings
- Added Support environment variables
- Added Create SystemSettingConfigLoader
- Fixed Bytebuddy binding is not working properly
- Added YAML config loader