Changes for page WebObjects with Scala

Last modified by Ravi Mendis on 2011/05/10 02:10

From version 352.1
edited by Ravi Mendis
on 2009/10/13 02:09
Change comment: There is no comment for this version
To version 355.1
edited by Ravi Mendis
on 2009/10/13 23:34
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -47,8 +47,10 @@
47 47  Scala doesn't have static variables or methods. However, a class can have a //Companion Object// that will allow you to achieve something equivalent to static variables.
48 48  One of the advantages of this approach is that it is **thread-safe**, so you don't have to worry about synchronizing access to these fields in a concurrent application.
49 49  
50 -In Java:
50 +The following is an example of the use of a //Companion Object// for Talent in Scala instead of static fields in Java.
51 51  
52 +Java:
53 +
52 52  {{code}}
53 53  
54 54  public class _Talent extends EOGenericRecord {
... ... @@ -56,7 +56,7 @@
56 56  
57 57  {{/code}}
58 58  
59 -In Scala:
61 +Scala:
60 60  
61 61  {{code}}
62 62  
... ... @@ -153,7 +153,7 @@
153 153  
154 154  {{/code}}
155 155  
156 -== How to Use Scala Collections with WebObjects ==
158 +== How to Use Scala Collections with EOF ==
157 157  
158 158  One of the benefits of Scala is its very powerful, concurrency-ready collection classes - primarily ##List##, ##Map##, ##Seq## and ##Set##.
159 159  Employing these instead of ##NSArray## and ##NSDictionary## in WebObjects/EOF may be challenging.
... ... @@ -184,16 +184,18 @@
184 184  
185 185  == WO Scala Example ==
186 186  
187 -The following example is a mixed Java/Scala version of the WO Movies D2W app.
189 +The following example is an almost 100% Scala WO app. In reality it is a mixed Java/Scala app:
188 188  All the EO logic and WO components are in Scala.
189 189  Only the Application class is Java.
190 190  
193 +It is based on the D2W Movies example.
194 +
191 191  {{attachments patterns=".*zip"}}{{/attachments}}
192 192  
193 193  === Setup ===
194 194  
195 195  1. [[Install the Scala eclipse IDE>>http://www.scala-lang.org/node/94]]
196 -1. Install and run the OpenBase OBMovies database.
200 +1. Install and start the OpenBase OBMovies database.
197 197  1. Right-click on Application.java and run as a WOApplication (as usual).
198 198  
199 199  ==== EO Templates ====
... ... @@ -202,5 +202,6 @@
202 202  
203 203  When you create your ##.eogen## file, be sure to make the following changes in the EOGenerator Editor:
204 204  
209 +1. Point to the local .eotemplate files for ##Entity## and ##//Entity//##
205 205  1. Change the File Names Extension to "scala"
206 206  1. Uncheck Java under Options