tschuchort
03/28/2019, 10:46 AMUserIdAndName
. If you need a lot of those (possibly with many fields), then call it UserSlice
or whatever and make it a copy of User
where every field of type T
becomes a Optional<T>
. You can also generate those with an annotation processor fairly easily (disregarding the problems with mapped types in Kotlin).
I'm sure there's a more elegant solution (particularly if you have access to structural types) but if there's one thing I have learned in my young career, it's not to get hung up on such small issues or you will never finish anything.