Created
June 12, 2015 02:38
-
-
Save searler/80eeed9f7e7bbcd9c9d9 to your computer and use it in GitHub Desktop.
Java Interface/Scala case class interop using BeanProperty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interop; | |
public interface JavaData { | |
String getValue(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interop; | |
public class JavaDataDriver { | |
public static void main(String[] args) { | |
JavaData d = new ScalaData("x"); | |
System.out.println(d.getValue()); // x | |
System.out.println(d.toString()); // ScalaData(x) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package interop | |
import scala.beans.BeanProperty | |
case class ScalaData(@BeanProperty value:String) extends interop.JavaData |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment