Call Kotlin's sealed class from Java

Kotlin

sealed class Entity{
  object NotFound(): Entity()
  data class Found(val count:Int): Entity() 
}

Java

//Call to object
new Entity.NotFound()
//call to data class
new Entity.Found(1)

Recommended Posts

Call Kotlin's sealed class from Java
[Android] Call Kotlin's default argument method from Java
Java method call from RPG (method call in own class)
Implement Java Interface in JRuby class and call it from Java
Call TensorFlow Java API from Scala
Call Java library from C with JNI
Call GitHub API from Java Socket API part2
Call Java method from JavaScript executed in Java
Why does Java call a file a class?
Call Java methods from Nim using jnim
Java class methods
[Java] Class inheritance
java Scanner class
Java HashMap class
java (abstract class)
[Java] Nested class
Java anonymous class
About Java class
[java] abstract class
[Java] Object class
Java local class
How to get Class from Element in Java
Java starting from beginner, class declaration / object generation
Kotlin's reified function cannot be called from java.
About class division (Java)
Changes from Java 8 to Java 11
Sum from Java_1 to 100
About Java StringBuilder class
[Java] About Singleton Class
Eval Java source from Java
Call a method with a Kotlin callback block from Java
Write a class in Kotlin and call it in Java
Java inner class review
Access API.AI from Java
Kotlin's improvements to Java
Java class type field
Java programming (class method)
About Java String class
From Java to Ruby !!
JAVA constructor call processing
Call a program written in Swift from Processing (Java)
Java programming (class structure)
About java abstract class
Find the address class and address type from the IP address with Java
[Kotlin] Get Java Constructor / Method from KFunction and call it
[Java] Integer wrapper class reference
Java memo (standard class) substring
Migration from Cobol to JAVA
Java tips --StaticUtility class modifier
Java inflexible String class substring
Java starting from beginner, override
Java memo (standard class) length
Creating ElasticSearch index from Java
New features from Java7 to Java8
[Implementation] Java Process class notes
About Java class loader types
How to use java class
[Java] Comparator of Collection class
Connect from Java to PostgreSQL
Java class definition and instantiation
Java, instance starting from beginner