Sunday, 15 September 2013

playframework 2.0 - Accessing public static java method from scala -



playframework 2.0 - Accessing public static java method from scala -

i'm trying utilize java facebook library here http://restfb.com/#publishing in scala play2 app, when trying phone call static with methods below, gives me "compliation error [identifier expected 'with' found.]".

val fbclass = classof[facebooktype] val param = parameter.with("message", msg) val attachment = binaryattachment.with("cat.png", stream) val fbresp = facebookclient.publish("me/photos", fbclass, attachment, param)

i see there issue trying invoke protected static methods, these defined public, can seen in javadocs , source. doing wrong?

with keyword in scala, example, used in mixin multiple traits.

class extends b c d

so if method named with in java library, need surround `` (backtick) when calling it:

binaryattachment.`with`("cat.png", stream)

scala playframework-2.0

No comments:

Post a Comment