Skip to content

Instantly share code, notes, and snippets.

@searler
Created June 12, 2015 02:38
Show Gist options
  • Save searler/80eeed9f7e7bbcd9c9d9 to your computer and use it in GitHub Desktop.
Save searler/80eeed9f7e7bbcd9c9d9 to your computer and use it in GitHub Desktop.
Java Interface/Scala case class interop using BeanProperty
package interop;
public interface JavaData {
String getValue();
}
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)
}
}
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