Scala wrapper API for java API
<p>I am new to Scala and I need to have a scala wrapper for my Java API</p>

<p>I have three Java Interfaces  </p>

<pre><code>public interface Client&lt;T&gt; {

   &lt;T&gt; Future&lt;T&gt; execute(App&lt;T&gt; app);

}

public interface App&lt;T&gt; extends Serializable{

  T process(AppContext context) throws Exception;

}

public interface AppContext {

  File getDirectory();

  void deleteDirectory();

  File createDirectory(String path);

}
</code></pre>

<p>Following is the Java code to create an App</p>

<pre><code>public class RandomApp extends App&lt;String&gt; {

  @Override
  public String process(AppContext context) {

      // Inorder to access the methods in AppContext I need to access  
      // it by the following way

      appContext.createDirectory("some path");
      return "random";
  }
 }
</code></pre>

<p>I want to have a Scala Wrapper for the Client Interface which in turn call the Java API. But I have some modifications for the new Scala API</p>

<pre><code>object ScalaConverter {

  implicit class ScalaWrapper(client: Client) {

  def scalaClient = new ScalaClient(client)

  }
}

class ScalaClient(client: Client) {

  def execute[T](appContext: AppContext =&gt; T): Future[T] = {

      // I am passing appContext as closure instead of passing in
      // App because I want to take the advantage of Closures in Scala

      // I basically want to create an App with this appContext and
      // pass it to the execute method

      // For example - but this is not working

      var app = // Need to create this app with appContext

      Future {
        client.execute(app)
      }
  }

}
</code></pre>