Integrating Scala components in a Java application | akquinet AG – Blog
Scala is starting to be really popular, and there are many reasons why you might like to use it in your current projects. At akquinet we’re now using Scala inside Java applications to reduce the amount of written code and to benefit from Scala’s flexibility. However, integrating Java and Scala in the same application requires some tricks. Using Java classes in Scala is pretty straightforward; however, using Scala classes in Java is not. Scala has several language features which cannot be directly mapped to Java, for example function types and traits. Here we will describe how these language features are compiled to Java byte code and how to access them from Java afterwards. Unit and Any Unit or Any void and Object respectively. Scala special characters Scala’s syntax is more relaxed than Java’s with regard to special characters. Consider for example the following code snippet where Scala mimicks properties: class ScalaPerson(var _name: String) { def name = _name def name_= (value:Read full article from Integrating Scala components in a Java application | akquinet AG – Blog
No comments:
Post a Comment