I'm trying to use the Java facebook library here http://restfb.com/#publishing in a scala play2 app, but when trying to call the static with
methods below, it gives me "Compliation Error [identifier expected but '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 that there is an issue trying to invoke protected static methods, but these are defined as public, as can be seen in the javadocs and the source. Am I doing something wrong?
with
is a keyword in Scala, for example, used in mixin multiple traits.
class A extends B with C with D
So if a method is named with
in Java library, you need surround it with `` (backtick) when you calling it:
BinaryAttachment.`with`("cat.png", stream)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With