svn commit: r691150 - in /activemq/camel/trunk/components/camel-scala: pom.xml src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r691150 - in /activemq/camel/trunk/components/camel-scala: pom.xml src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala

gertv-2
Author: gertv
Date: Tue Sep  2 01:29:26 2008
New Revision: 691150

URL: http://svn.apache.org/viewvc?rev=691150&view=rev
Log:
CAMEL-463: Trying to get rid of classOf() for specifying types

Modified:
    activemq/camel/trunk/components/camel-scala/pom.xml
    activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
    activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala

Modified: activemq/camel/trunk/components/camel-scala/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/pom.xml?rev=691150&r1=691149&r2=691150&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/pom.xml (original)
+++ activemq/camel/trunk/components/camel-scala/pom.xml Tue Sep  2 01:29:26 2008
@@ -13,8 +13,8 @@
 
   <properties>
     <camel.osgi.export.pkg>org.apache.camel.scala.*</camel.osgi.export.pkg>
-    <scala-version>2.7.1</scala-version>
-    <scala-plugin-version>2.6</scala-plugin-version>
+    <scala-version>2.7.2-rc1</scala-version>
+    <scala-plugin-version>2.7.1</scala-plugin-version>
   </properties>
 
   <repositories>
@@ -48,9 +48,6 @@
             </goals>
           </execution>
         </executions>
-        <configuration>
-          <scalaVersion>${scala-version}</scalaVersion>
-        </configuration>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>

Modified: activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala?rev=691150&r1=691149&r2=691150&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala Tue Sep  2 01:29:26 2008
@@ -20,6 +20,7 @@
 import org.apache.camel.model.ChoiceType
 
 import collection.mutable.Stack
+import _root_.scala.reflect.Manifest
 
 import org.apache.camel.scala.dsl._
 
@@ -49,8 +50,10 @@
   }
 
   def from(uri: String) = new SRouteType(builder.from(uri), this)
-  def handle[Target](exception: Class[Target]) = new SExceptionType(builder.exception(exception))(this)
-  
+  def handle[E](block: => Unit)(implicit manifest: Manifest[E]) = {
+     val exception = new SExceptionType(builder.exception(manifest.erasure))(this)
+     exception.apply(block)
+  }  
 
   def attempt = stack.top.attempt
   def bean(bean: Any) = stack.top.bean(bean)

Modified: activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala?rev=691150&r1=691149&r2=691150&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala (original)
+++ activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/ExceptionHandlerTest.scala Tue Sep  2 01:29:26 2008
@@ -54,11 +54,11 @@
        }
       
        //START SNIPPET: simple
-       handle(classOf[UnsupportedOperationException]) to "mock:c"
+       handle[UnsupportedOperationException] { to ("mock:c") }
        //END SNIPPET: simple
       
        //START SNIPPET: block
-       handle(classOf[RuntimeException]) {
+       handle[RuntimeException] {
            process(catchProcessor)
            to ("mock:b")
        }