Changes for page WebObjects with Scala
Last modified by Ravi Mendis on 2011/05/10 02:10
From version 524.1
edited by Ravi Mendis
on 2010/07/26 06:32
on 2010/07/26 06:32
Change comment:
There is no comment for this version
To version 525.1
edited by Ravi Mendis
on 2010/08/12 03:16
on 2010/08/12 03:16
Change comment:
Remove Openbase DB dependency
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -195,16 +195,20 @@ 195 195 196 196 {{code}} 197 197 198 -def movies: NSArray[Studio] = { 199 - storedValueForKey(_Studio.Keys.MOVIES).asInstanceOf[NSArray[Studio]] 198 +import scala.collection.JavaConversions._ 199 + 200 +def movies = { 201 + storedValueForKey(_Studio.Keys.MOVIES).asInstanceOf[NSArray[Movie]] 200 200 } 201 201 202 -def moviesList :List[Studio]= {203 - movies. objects.toList204 +def moviesList = { 205 + movies.asInstanceOf[java.lang.Iterable[Movie]].toList 204 204 } 205 205 206 206 {{/code}} 207 207 210 +This employs a feature of Scala known as **implicit conversions** to automagically convert a NSArray (a Java Iterable) into a Scala Iterable. 211 + 208 208 == How to Add Scala to a WO Project == 209 209 210 210 {{include value="WOL:Adding Scala Support to a WOLips Project"}}{{/include}} ... ... @@ -228,7 +228,6 @@ 228 228 === Setup === 229 229 230 230 1. [[Install the Scala eclipse IDE>>http://www.scala-ide.org/]] 231 -1. Install and start the OpenBase OBMovies database. 232 232 1. Right-click on Application.java and run as a WOApplication (as usual). 233 233 234 234 ==== EO Templates ====