Is it possible to somehow extract implementation of sealed classes to separate files and still use
SealedClass.InnerClass
syntax?
For example:
sealed class Message(val...) {
class Text(...) : Message(...) {
...
}
class Image(...) : Message(...) {
...
}
}
when (message) {
is Message.Text -> ...
is Message.Image -> ...
}
fun someFun(val msg: Message.Text) {}
But if I extract
Text
and
Image
to separete file from
Message
class file, because that file can be easiliy thounds of lines of code long, it would become:
when (message) {
is Text -> ...
is Image -> ...
}
fun someFun(val msg: Text) {}
And when using those classes all around a project you lose hierarchy that
Text
is part of
Message
. I think it's still more pretty to use
Message.Text
. Could be possible somehow to combine best of both worlds?