Closed MikolajKakol closed 10 months ago
Could you elaborate on this? What is the usecase of the null value as a constant?
I'm using Gradle properties to read some constants. I'd like to model absence of them.
What I do is defining in local.properties proxy address for app and if it's not defined like on CI it's not installed on http client.
Thanks for the detail!
Do you really need to distinguish null and empty string? If not, I'd recommend you to use an empty string as an empty value, rather than using null.
What about exposing a getHasKey
method?
With String
it's kind of okay... however I also have some int's there and modeling it as -1/0 is just, you know :)
I feel that it would be a good addition to support nullable types since it's very deep in Kotlin roots.
That sounds reasonable. How would you like to configure nullable value? Any idea?
I'm using kts. The current method is buildConfigField
I was thinking about adding simple buildConfigNullableField
.
However, it's a bit more wast problem. Right now we are constrained by Type
enum in FieldSpec
. I think it maybe could be a sealed class and we should allow a user to enter any primitive supported by the language.
I could help with two PR, one for simple nullable and one that would try to tackle that second matter. It could also provide some type safety before compilation.
fun <T: Any?> buildConfigField(
name: String,
value: T
)
would be a perfect method signature if possible.
buildConfigNullableField
looks nice 👍
Regarding the second suggestion, I'm not sure if it works well but let's see how it goes ;)
I've just released 0.5.0 with changes from #21
Hi, it would be great to add nullable support. Any thoughts about this? If help is needed I could try.