How to use OneOf? #2365
Answered
by
oldergod
DenisVoronets
asked this question in
Q&A
How to use OneOf?
#2365
-
Hello!
For now I check like this:
Question is: how can I use OneOf in Kotlin to handle message Type? |
Beta Was this translation helpful? Give feedback.
Answered by
oldergod
Dec 20, 2022
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
DenisVoronets
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oneof
s fields are inlined. We do a null check on each one of those fields until we find the one set. On top of it, we have a runtime check which throws if more than one field within aoneof
is set. We don't offer ways to smartcast the set fields; that might be doable with extension functions?