I'm not sure of the best channel for this discussion, but it deals with delegates and how they are used to grab Property File values.
I have seen it described very similarly before in an article that we can use a simple convention such as
val 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.