ciscorucinski
10/16/2020, 12:29 PMval pluginGroup: String by project
This will search for .property files for the key pluginGroup
and return it's value as a String
. I am impressed by that, but how the heck does this magic work?
This will only return String
values, so even if we have the following in the .properties file...
platformDownloadSources = true
It will still only return "true"
as a String
.
I am curious of how this mechanism works and why it is limited to only String
and why it is limited to the specific name I have for the variable. Meaning I must name my variable the same as is in the .properties file.Vampire
10/16/2020, 12:34 PMProperties
implements Map
so this applies: https://kotlinlang.org/docs/reference/delegated-properties.html#storing-properties-in-a-mapciscorucinski
10/16/2020, 12:34 PMVampire
10/16/2020, 12:36 PMephemient
10/16/2020, 12:36 PMephemient
10/16/2020, 12:37 PMgetValue()
on ExtensionContainer
(which Project
is)ephemient
10/16/2020, 12:38 PMby extra
, by ext(defaultValue)
etc workephemient
10/16/2020, 12:39 PMciscorucinski
10/16/2020, 12:40 PMVampire
10/16/2020, 12:41 PM