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

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

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

Scala.Option介绍

[英]Wrap a value into a Scala Option.
[中]将值包装到Scala选项中。

代码示例

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

/**
 * Generates a JavaScript reverse router.
 *
 * @param name the router's name
 * @param ajaxMethod which asynchronous call method the user's browser will use (e.g. "jQuery.ajax")
 * @param host the host to use for the reverse route
 * @param routes the reverse routes for this router
 * @return the router
 */
public static JavaScript create(String name, String ajaxMethod, String host, JavaScriptReverseRoute... routes) {
  return play.api.routing.JavaScriptReverseRouter.apply(
    name, Scala.Option(ajaxMethod), host, Scala.varargs(routes)
  );
}

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

/**
 * Generates a JavaScript reverse router.
 *
 * @param name the router's name
 * @param ajaxMethod which asynchronous call method the user's browser will use (e.g. "jQuery.ajax")
 * @param host the host to use for the reverse route
 * @param routes the reverse routes for this router
 * @return the router
 */
public static JavaScript create(String name, String ajaxMethod, String host, JavaScriptReverseRoute... routes) {
  return play.api.routing.JavaScriptReverseRouter.apply(
    name, Scala.Option(ajaxMethod), host, Scala.varargs(routes)
  );
}

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

/**
 * Generates a JavaScript reverse router.
 *
 * @param name the router's name
 * @param ajaxMethod which asynchronous call method the user's browser will use (e.g. "jQuery.ajax")
 * @param host the host to use for the reverse route
 * @param routes the reverse routes for this router
 * @return the router
 */
public static JavaScript create(String name, String ajaxMethod, String host, JavaScriptReverseRoute... routes) {
  return play.api.routing.JavaScriptReverseRouter.apply(
    name, Scala.Option(ajaxMethod), host, Scala.varargs(routes)
  );
}

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

/**
   * Convert this result to a Scala result.
   *
   * @return the Scala result.
   */
  public play.api.mvc.Result asScala() {
    return new play.api.mvc.Result(
      header.asScala(),
      body.asScala(),
      session == null ? Scala.None() : Scala.Option(play.api.mvc.Session.fromJavaSession(session)),
      flash == null ? Scala.None() : Scala.Option(play.api.mvc.Flash.fromJavaFlash(flash)),
      JavaHelpers$.MODULE$.cookiesToScalaCookies(cookies)
    );
  }
}

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

/**
   * Convert this result to a Scala result.
   *
   * @return the Scala result.
   */
  public play.api.mvc.Result asScala() {
    return new play.api.mvc.Result(
      header.asScala(),
      body.asScala(),
      session == null ? Scala.None() : Scala.Option(play.api.mvc.Session.fromJavaSession(session)),
      flash == null ? Scala.None() : Scala.Option(play.api.mvc.Flash.fromJavaFlash(flash)),
      JavaHelpers$.MODULE$.cookiesToScalaCookies(cookies)
    );
  }
}

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

/**
   * Convert this result to a Scala result.
   *
   * @return the Scala result.
   */
  public play.api.mvc.Result asScala() {
    return new play.api.mvc.Result(
      header.asScala(),
      body.asScala(),
      session == null ? Scala.None() : Scala.Option(play.api.mvc.Session.fromJavaSession(session)),
      flash == null ? Scala.None() : Scala.Option(play.api.mvc.Flash.fromJavaFlash(flash)),
      JavaHelpers$.MODULE$.cookiesToScalaCookies(cookies)
    );
  }
}

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

/**
 * Generates a JavaScript router.
 */
public static JavaScript javascriptRouter(String name, String ajaxMethod, play.api.routing.JavaScriptReverseRoute... routes) {
  return play.api.Routes.javascriptRouter(
    name, Scala.Option(ajaxMethod), play.mvc.Http.Context.current().request().host(), Scala.toSeq(routes)
  );
}

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

/**
 * @return This event formatted according to the EventSource protocol.
 */
public String formatted() {
  return new play.api.libs.EventSource.Event(data, Scala.Option(id), Scala.Option(name)).formatted();
}

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

/**
 * @return This event formatted according to the EventSource protocol.
 */
public String formatted() {
  return new play.api.libs.EventSource.Event(data, Scala.Option(id), Scala.Option(name)).formatted();
}

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

/**
 * @return This event formatted according to the EventSource protocol.
 */
public String formatted() {
  return new play.api.libs.EventSource.Event(data, Scala.Option(id), Scala.Option(name)).formatted();
}

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

/**
 * @return This event formatted according to the EventSource protocol.
 */
public String formatted() {
  return new play.api.libs.EventSource.Event(data, Scala.Option(id), Scala.Option(name)).formatted();
}

代码示例来源:origin: uk.gov.hmrc/microservice-bootstrap-java

public HeaderCarrier hc(Request<?> request) {
  return HeaderCarrier.fromHeadersAndSession(request.headers(), Option(request.session()));
}

代码示例来源:origin: uk.gov.hmrc/microservice-bootstrap-java

public HeaderCarrier hc(Request<?> request) {
  return HeaderCarrier.fromHeadersAndSession(request.headers(), Option(request.session()));
}

代码示例来源:origin: play/play-test

/**
 * Add cookies to this request
 */
@SuppressWarnings(value = "unchecked")
public FakeRequest withCookies(Http.Cookie... cookies) {
  List <play.api.mvc.Cookie> scalacookies = new ArrayList<play.api.mvc.Cookie>();
  for (Http.Cookie c : cookies) {
    scalacookies.add(new play.api.mvc.Cookie(c.name(), c.value(), Scala.<Object>Option(c.maxAge()), c.path(), Scala.Option(c.domain()), c.secure(), c.httpOnly()) );
  }
  fake = fake.withCookies(Scala.varargs(scalacookies.toArray()));
  return this;
}

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

/**
 * Retrieve the URL where the user should be redirected to start the OpenID authentication process
 */
@Override
public CompletionStage<String> redirectURL(
    String openID, String callbackURL, Map<String, String> axRequired, Map<String, String> axOptional, String realm) {
  if (axRequired == null) axRequired = new HashMap<>();
  if (axOptional == null) axOptional = new HashMap<>();
  return FutureConverters.toJava(client.redirectURL(openID,
      callbackURL,
      JavaConversions.mapAsScalaMap(axRequired).toSeq(),
      JavaConversions.mapAsScalaMap(axOptional).toSeq(),
      Scala.Option(realm)));
}

代码示例来源:origin: play/play-java

/**
 * Retrieve the URL where the user should be redirected to start the OpenID authentication process
 */
public static F.Promise<String> redirectURL(String openID,
    String callbackURL,
    Map<String, String> axRequired,
    Map<String, String> axOptional,
    String realm) {
  if (axRequired == null) axRequired = new HashMap<String, String>();
  if (axOptional == null) axOptional = new HashMap<String, String>();
  return new F.Promise<String>(play.api.libs.openid.OpenID.redirectURL(openID,
                                     callbackURL,
                                     JavaConversions.mapAsScalaMap(axRequired).toSeq(),
                                     JavaConversions.mapAsScalaMap(axOptional).toSeq(),
                                     Scala.Option(realm)));
}

相关文章