Question: From Java call Scala's Singleton object apply with trait
I have a pattern in scala like:
object ApiConnector { def apply(x: String): ApiConnector = new ApiConnectorImpl(x) } trait ApiConnector { ... } class ApiConnectorImpl extends ApiConnector {...}
when in Java code I want to use apply method like ApiConnector.apply("x")
then I got an error:
Cannot access eu.xyz.api.ApiConnector
any ideas how to access this apply method from java code ?
9codings