play.libs.Scala.asScala()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中play.libs.Scala.asScala()方法的一些代码示例,展示了Scala.asScala()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scala.asScala()方法的具体详情如下:
包路径:play.libs.Scala
类名称:Scala
方法名:asScala

Scala.asScala介绍

[英]Converts a Java Collection to a Scala Seq.
[中]将Java集合转换为Scala Seq。

代码示例

代码示例来源:origin: com.typesafe.play/play-test_2.11

/**
 * Executes a block of code in a running server.
 * @param server    the server to start.
 * @param block  the block of code to run after the server starts.
 */
public static void running(TestServer server, final Runnable block) {
  Helpers$.MODULE$.running(server, asScala(() -> { block.run(); return null; }));
}

代码示例来源:origin: com.typesafe.play/play-test_2.12

/**
 * Executes a block of code in a running server.
 * @param server    the server to start.
 * @param block  the block of code to run after the server starts.
 */
public static void running(TestServer server, final Runnable block) {
  Helpers$.MODULE$.running(server, asScala(() -> { block.run(); return null; }));
}

代码示例来源:origin: com.typesafe.play/play-test_2.12

/**
 * Executes a block of code in a running application.
 *
 * @param application the application context.
 * @param block       the block to run after the Play app is started.
 */
public static void running(Application application, final Runnable block) {
  Helpers$.MODULE$.running(application.asScala(), asScala(() -> { block.run(); return null; }));
}

代码示例来源:origin: com.typesafe.play/play-test_2.11

/**
 * Executes a block of code in a running application.
 *
 * @param application the application context.
 * @param block       the block to run after the Play app is started.
 */
public static void running(Application application, final Runnable block) {
  Helpers$.MODULE$.running(application.asScala(), asScala(() -> { block.run(); return null; }));
}

代码示例来源:origin: com.typesafe.play/play-test_2.12

/**
 * Constructs a in-memory (h2) database configuration to add to a fake application.
 *
 * @param name       the database name.
 * @param options the database options.
 * @return a map of String containing database config info.
 */
public static Map<String, String> inMemoryDatabase(String name, Map<String, String> options) {
  return Scala.asJava(play.api.test.Helpers.inMemoryDatabase(name, Scala.asScala(options)));
}

代码示例来源:origin: com.typesafe.play/play-test_2.10

/**
 * Constructs a in-memory (h2) database configuration to add to a FakeApplication.
 */
public static Map<String,String> inMemoryDatabase(String name, Map<String, String> options) {
  return Scala.asJava(play.api.test.Helpers.inMemoryDatabase(name, Scala.asScala(options)));
}

代码示例来源:origin: com.typesafe.play/play-test_2.11

/**
 * Constructs a in-memory (h2) database configuration to add to a fake application.
 *
 * @param name       the database name.
 * @param options the database options.
 * @return a map of String containing database config info.
 */
public static Map<String, String> inMemoryDatabase(String name, Map<String, String> options) {
  return Scala.asJava(play.api.test.Helpers.inMemoryDatabase(name, Scala.asScala(options)));
}

代码示例来源:origin: com.typesafe.play/play-test_2.11

/**
 * Executes a block of code in a running server, with a test browser.
 *
 * @param server    the test server.
 * @param webDriver the web driver instance.
 * @param block     the block of code to execute.
 */
public static void running(TestServer server, WebDriver webDriver, final Consumer<TestBrowser> block) {
  Helpers$.MODULE$.runSynchronized(server.application(), asScala(() -> {
    TestBrowser browser = null;
    TestServer startedServer = null;
    try {
      start(server);
      startedServer = server;
      browser = testBrowser(webDriver, (Integer) OptionConverters.toJava(server.config().port()).get());
      block.accept(browser);
    } finally {
      if (browser != null) {
        browser.quit();
      }
      if (startedServer != null) {
        stop(startedServer);
      }
    }
    return null;
  }));
}

代码示例来源:origin: com.typesafe.play/play-test_2.12

/**
 * Executes a block of code in a running server, with a test browser.
 *
 * @param server    the test server.
 * @param webDriver the web driver instance.
 * @param block     the block of code to execute.
 */
public static void running(TestServer server, WebDriver webDriver, final Consumer<TestBrowser> block) {
  Helpers$.MODULE$.runSynchronized(server.application(), asScala(() -> {
    TestBrowser browser = null;
    TestServer startedServer = null;
    try {
      start(server);
      startedServer = server;
      browser = testBrowser(webDriver, (Integer) OptionConverters.toJava(server.config().port()).get());
      block.accept(browser);
    } finally {
      if (browser != null) {
        browser.quit();
      }
      if (startedServer != null) {
        stop(startedServer);
      }
    }
    return null;
  }));
}

代码示例来源:origin: com.typesafe.play/play-test_2.10

Scala.toSeq(additionalPlugins),
Scala.toSeq(withoutPlugins),
Scala.asScala((Map<String, Object>) additionalConfiguration),
scala.Option.apply(scalaGlobal),
scala.PartialFunction$.MODULE$.<scala.Tuple2<String, String>, Handler>empty()

代码示例来源:origin: com.typesafe.play/play

/**
 * Convert this session to a Scala session.
 *
 * @return the Scala session.
 */
public play.api.mvc.Session asScala() {
  return new play.api.mvc.Session(Scala.asScala(this));
}

代码示例来源:origin: com.typesafe.play/play_2.12

/**
 * Returns a new session with the values from the given map added.
 */
public Session adding(Map<String, String> values) {
  return new play.api.mvc.Session(Scala.asScala(this)).$plus$plus(Scala.asScala(values)).asJava();
}

代码示例来源:origin: com.typesafe.play/play_2.10

/**
 * Set a Form url encoded body to this request.
 */
public RequestBuilder bodyForm(Map<String,String> data) {
  Map<String,Seq<String>> seqs = new HashMap<>();
  for (Entry<String,String> entry: data.entrySet()) {
    seqs.put(entry.getKey(), JavaConversions.asScalaBuffer(Arrays.asList(entry.getValue())));
  }
  scala.collection.immutable.Map<String,Seq<String>> map = asScala(seqs);
  return body(new AnyContentAsFormUrlEncoded(map), "application/x-www-form-urlencoded");
}

代码示例来源:origin: com.typesafe.play/play_2.11

@Override
public void configure(Environment env, Config configuration, Map<String, String> optionalProperties) {
  delegate.configure(
    env.asScala(),
    new play.api.Configuration(configuration),
    Scala.asScala(optionalProperties)
  );
}

代码示例来源:origin: com.typesafe.play/play_2.12

/**
 * Returns a new flash with the given keys removed.
 */
public Flash removing(String... keys) {
  return new play.api.mvc.Flash(Scala.asScala(this)).$minus$minus(Scala.toSeq(keys)).asJava();
}

代码示例来源:origin: com.typesafe.play/play_2.11

/**
 * Returns a new session with the given keys removed.
 */
public Session removing(String... keys) {
  return new play.api.mvc.Session(Scala.asScala(this)).$minus$minus(Scala.toSeq(keys)).asJava();
}

代码示例来源:origin: com.typesafe.play/play_2.11

/**
 * Returns a new flash with the given key-value pair added.
 */
public Flash adding(String key, String value) {
  return new play.api.mvc.Flash(Scala.asScala(this)).$plus(Scala.Tuple(key, value)).asJava();
}

代码示例来源:origin: com.typesafe.play/play_2.12

/**
 * Sets all parameters for the session.
 * @param data a key value mapping of the session data
 * @return the builder instance
 */
public RequestBuilder session(Map<String,String> data) {
  play.api.mvc.Session session = new play.api.mvc.Session(Scala.asScala(data));
   attr(new TypedKey<>(RequestAttrKey.Session()), new AssignedCell<>(session));
  return this;
}

代码示例来源:origin: com.typesafe.play/play_2.11

/**
 * Sets all parameters for the session.
 * @param data a key value mapping of the session data
 * @return the builder instance
 */
public RequestBuilder session(Map<String,String> data) {
  play.api.mvc.Session session = new play.api.mvc.Session(Scala.asScala(data));
   attr(new TypedKey<>(RequestAttrKey.Session()), new AssignedCell<>(session));
  return this;
}

代码示例来源:origin: com.typesafe.play/play

/**
 * Sets all parameters for the session.
 * @param data a key value mapping of the session data
 * @return the builder instance
 */
public RequestBuilder session(Map<String,String> data) {
  play.api.mvc.Session session = new play.api.mvc.Session(Scala.asScala(data));
   attr(new TypedKey<>(RequestAttrKey.Session()), new AssignedCell<>(session));
  return this;
}

相关文章