<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Scala, Maven and Jersey</title>
	<atom:link href="http://codemonkeyism.com/scala-maven-and-jersey/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemonkeyism.com/scala-maven-and-jersey/</link>
	<description></description>
	<lastBuildDate>Tue, 03 Jan 2012 15:08:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: K</title>
		<link>http://codemonkeyism.com/scala-maven-and-jersey/comment-page-1/#comment-169348</link>
		<dc:creator>K</dc:creator>
		<pubDate>Fri, 19 Sep 2008 05:39:57 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/09/15/scala-maven-and-jersey/#comment-169348</guid>
		<description>Sorry, my mistake. 

Actually you get an instance of Seq (BoxedArray) of that repeated parameter but you can operate it (in Scala) like operating an Array.

If you want to operate it within the function as an Array (or pass it to Java), you must unboxed it using that suggestion.

If you want to pass it as an Array[Any] to another scala function what you only need to do is call x.toArray[Any]. Although you get another BoxedAnyArray, but when passing the parameter to a scala function, compiler will auto-unboxed it. Check following two function:

def a(is:Any*){
  println(is.getClass)
  println(is.toArray[Any].getClass)
  b(is.toArray[Any])
}

def b(is:Array[Any]){
  println(is.getClass)
  println(is)
}

a(1, &quot;String&quot;)

you will get following output: (I tested this using Scala 2.7.1)
class scala.runtime.BoxedObjectArray
class scala.runtime.BoxedAnyArray
class [Ljava.lang.Object;
[Ljava.lang.Object;@1710808

Implementation of array in Scala is quite interesting, for detail see http://www.drmaciver.com/2008/06/scala-arrays/</description>
		<content:encoded><![CDATA[<p>Sorry, my mistake. </p>
<p>Actually you get an instance of Seq (BoxedArray) of that repeated parameter but you can operate it (in Scala) like operating an Array.</p>
<p>If you want to operate it within the function as an Array (or pass it to Java), you must unboxed it using that suggestion.</p>
<p>If you want to pass it as an Array[Any] to another scala function what you only need to do is call x.toArray[Any]. Although you get another BoxedAnyArray, but when passing the parameter to a scala function, compiler will auto-unboxed it. Check following two function:</p>
<p>def a(is:Any*){<br />
  println(is.getClass)<br />
  println(is.toArray[Any].getClass)<br />
  b(is.toArray[Any])<br />
}</p>
<p>def b(is:Array[Any]){<br />
  println(is.getClass)<br />
  println(is)<br />
}</p>
<p>a(1, &#8220;String&#8221;)</p>
<p>you will get following output: (I tested this using Scala 2.7.1)<br />
class scala.runtime.BoxedObjectArray<br />
class scala.runtime.BoxedAnyArray<br />
class [Ljava.lang.Object;<br />
[Ljava.lang.Object;@1710808</p>
<p>Implementation of array in Scala is quite interesting, for detail see <a href="http://www.drmaciver.com/2008/06/scala-arrays/" rel="nofollow">http://www.drmaciver.com/2008/06/scala-arrays/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/scala-maven-and-jersey/comment-page-1/#comment-168718</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 18 Sep 2008 06:33:28 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/09/15/scala-maven-and-jersey/#comment-168718</guid>
		<description>@K: Sure? Because I though I&#039;ve got a Seq and people on the net suggest

def g(x: Any*) = 
x.asInstanceOf[scala.runtime.BoxedObjectArray].unbox(x.getClass).asInstanceOf[Array[Object]]

(which by the way works)</description>
		<content:encoded><![CDATA[<p>@K: Sure? Because I though I&#8217;ve got a Seq and people on the net suggest</p>
<p>def g(x: Any*) =<br />
x.asInstanceOf[scala.runtime.BoxedObjectArray].unbox(x.getClass).asInstanceOf[Array[Object]]</p>
<p>(which by the way works)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K</title>
		<link>http://codemonkeyism.com/scala-maven-and-jersey/comment-page-1/#comment-168715</link>
		<dc:creator>K</dc:creator>
		<pubDate>Thu, 18 Sep 2008 06:26:17 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/09/15/scala-maven-and-jersey/#comment-168715</guid>
		<description>By default if you specified a function

def a(b:A*)

You will get b as an instance of type Array[A]

For testing purpose, you can check this in scala console.</description>
		<content:encoded><![CDATA[<p>By default if you specified a function</p>
<p>def a(b:A*)</p>
<p>You will get b as an instance of type Array[A]</p>
<p>For testing purpose, you can check this in scala console.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/scala-maven-and-jersey/comment-page-1/#comment-168281</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 17 Sep 2008 07:29:59 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/09/15/scala-maven-and-jersey/#comment-168281</guid>
		<description>@K: Perhaps you can help me with converting A* to Array[A]?

(which I need for a test project, not the case of the post)</description>
		<content:encoded><![CDATA[<p>@K: Perhaps you can help me with converting A* to Array[A]?</p>
<p>(which I need for a test project, not the case of the post)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K</title>
		<link>http://codemonkeyism.com/scala-maven-and-jersey/comment-page-1/#comment-168273</link>
		<dc:creator>K</dc:creator>
		<pubDate>Wed, 17 Sep 2008 07:19:10 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/09/15/scala-maven-and-jersey/#comment-168273</guid>
		<description>Array(&quot;text/html&quot;) === Array.apply(&quot;text/html&quot;) which is defined object Array (see http://www.scala-lang.org/docu/files/api/scala/Array$object.html#apply(A*)).

Although Scala does not support varargs, but it has a similar concept called &quot;repeated parameters&quot;</description>
		<content:encoded><![CDATA[<p>Array(&#8220;text/html&#8221;) === Array.apply(&#8220;text/html&#8221;) which is defined object Array (see <a href="http://www.scala-lang.org/docu/files/api/scala/Array$object.html#apply(A" rel="nofollow">http://www.scala-lang.org/docu/files/api/scala/Array$object.html#apply(A</a>*)).</p>
<p>Although Scala does not support varargs, but it has a similar concept called &#8220;repeated parameters&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/scala-maven-and-jersey/comment-page-1/#comment-167601</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Tue, 16 Sep 2008 03:58:18 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/09/15/scala-maven-and-jersey/#comment-167601</guid>
		<description>Ah, very nice, thanks.</description>
		<content:encoded><![CDATA[<p>Ah, very nice, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Spiewak</title>
		<link>http://codemonkeyism.com/scala-maven-and-jersey/comment-page-1/#comment-167492</link>
		<dc:creator>Daniel Spiewak</dc:creator>
		<pubDate>Mon, 15 Sep 2008 23:31:19 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/09/15/scala-maven-and-jersey/#comment-167492</guid>
		<description>It should work as expected under 2.7.2, but until then you&#039;re unfortunately stuck with Array(...).</description>
		<content:encoded><![CDATA[<p>It should work as expected under 2.7.2, but until then you&#8217;re unfortunately stuck with Array(&#8230;).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (user agent is rejected)
Database Caching 4/17 queries in 0.016 seconds using disk

Served from: codemonkeyism.com @ 2012-02-09 02:50:53 -->
