Changes for page WebObjects with Scala
Last modified by Ravi Mendis on 2011/05/10 02:10
From version 348.1
edited by Ravi Mendis
on 2009/10/12 21:31
on 2009/10/12 21:31
Change comment:
There is no comment for this version
To version 351.1
edited by Ravi Mendis
on 2009/10/13 02:09
on 2009/10/13 02:09
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -7,7 +7,7 @@ 7 7 8 8 |= |= Objective-C |= Java |= Scala 9 9 |= Mutable/Immuable Datatypes | Collections //e.g: NSArray/NSMutableArray// | No | Yes 10 -|= Closures | Blocks (//Extension//) | No | Anon .Functions10 +|= Closures | Blocks (//Extension//) | No | Anonymous Functions 11 11 |= Static variables | Yes | Yes | No 12 12 |= Static methods/functions | Yes | Yes | No 13 13 |= Concurrency | [[Grand Central Dispatch>>http://en.wikipedia.org/wiki/Grand_Central_Dispatch]] (//Extension//)| //Threads// |[[Actors>>http://en.wikipedia.org/wiki/Actor_model]] ... ... @@ -153,6 +153,25 @@ 153 153 154 154 {{/code}} 155 155 156 +== How to Use Scala Collections with WebObjects == 157 + 158 +One of the benefits of Scala is its very powerful, concurrency-ready collection classes - primarily ##List##, ##Map##, ##Seq## and ##Set##. 159 +Employing these instead of ##NSArray## and ##NSDictionary## in WebObjects/EOF may be challenging. 160 + 161 +But one may modify the EO templates to produce API such as: 162 + 163 +{{code}} 164 + 165 +def movies: NSArray[EOGenericRecord] = { 166 + storedValueForKey(_Studio.Keys.MOVIES).asInstanceOf[NSArray[EOGenericRecord]] 167 +} 168 + 169 +def moviesList: List[EOGenericRecord] = { 170 + movies.objects.toList 171 +} 172 + 173 +{{/code}} 174 + 156 156 == How to Add Scala to a WO Project == 157 157 158 158 {{include value="WOL:Adding Scala Support to a WOLips Project"}}{{/include}}