Could you show an example of it? In none of the materials published so far there is anything even remotely similar to what you are suggesting.
There you can read about algebraic data types in java, in Java 14 you get preview for records in Java 15 probably you'll get preview for sealed types - they were developed together for some time, only recently there was a split.