You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure whether this is in scope of this library, but I wanted to mention the idea:
Based on an existing data class which has non-nullable properties, I'm often in the need to create a variant of that class whose properties are the same, but nullable. A use-case is e.g. configuration classes with optional / nullable properties, that are turned into "full configuration classes" by applying non-null defaults to nullable properties, resulting in a configuration class with all non-nullable properties.
So, how about introducing an annotation named e.g. @CopyAsNullable that could be used like
@CopyAsNullable(to = "OptionalPerson")
data class Person(val name: String, val friends: List<Person>)
which would generate the class
data class OptionalPerson(val name: String? = null, val friends: List<Person>? = null)
The application of the default = null values could be made optional via another argument to @CopyAsNullable.
The text was updated successfully, but these errors were encountered:
I'm not sure whether this is in scope of this library, but I wanted to mention the idea:
Based on an existing data class which has non-nullable properties, I'm often in the need to create a variant of that class whose properties are the same, but nullable. A use-case is e.g. configuration classes with optional / nullable properties, that are turned into "full configuration classes" by applying non-null defaults to nullable properties, resulting in a configuration class with all non-nullable properties.
So, how about introducing an annotation named e.g.
@CopyAsNullable
that could be used likewhich would generate the class
The application of the default
= null
values could be made optional via another argument to@CopyAsNullable
.The text was updated successfully, but these errors were encountered: