本文整理汇总了Scala中org.json4s.JObject类的典型用法代码示例。如果您正苦于以下问题:Scala JObject类的具体用法?Scala JObject怎么用?Scala JObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JObject类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: CreateUserRequest
//设置package包名称以及导入依赖的类
package com.biosimilarity.evaluator.importer.dtos
import org.json4s.JObject
case class CreateUserRequest(
email: String,
password: String,
jsonBlob: JObject
) extends RequestContent
case class GetUserRequest(
email: String,
password: String
) extends RequestContent
case class UpdateUserRequest(
sessionURI: String,
jsonBlob: JObject
) extends RequestContent
开发者ID:synereo,项目名称:synereo,代码行数:20,代码来源:CreateUserRequest.scala
示例2: Interpret
//设置package包名称以及导入依赖的类
package us.grider.ghexplorer
import scalaj.http.HttpResponse
import org.json4s.{ JArray, JField, JInt, JObject, JString }
import org.json4s.native.JsonMethods.parse
object Interpret {
def apply(command: Command, http: Command => HttpResponse[String]): List[Int] = {
command match {
case ListPRs(repo) =>
val res = http(command)
val parsedBody = parse(res.body)
if (res.code >= 400) {
val errorMessage =
(parsedBody \ "message") match {
case JString(err) => err
case _ => "Error while attempting to list PRs"
}
throw new Exception(errorMessage)
} else {
parsedBody match {
case JArray(vals) => vals.collect {
case obj: JObject => obj \ "id"
}.collect {
case JInt(i) => i.toInt
}
case _ => List()
}
}
case _ => List()
}
}
}
开发者ID:mrerrormessage,项目名称:gh-explorer,代码行数:36,代码来源:Interpret.scala
示例3: FormElementSpec
//设置package包名称以及导入依赖的类
package com.yukimt.scrape.element
import org.specs2.mutable.Specification
import org.openqa.selenium.htmlunit.HtmlUnitDriver
import org.json4s.JObject
import org.json4s.jackson.JsonMethods
import ParserMethod._
import ElementMethod._
class FormElementSpec extends Specification{
sequential
implicit val driver = new HtmlUnitDriver(true)
driver.get("http://localhost:3000/view")
val parser = new Parser(driver)
var element = (parser >> css("form")) >> asForm
"FormElement" should {
"set query string" in {
element.setQueryString(Map("a"->"b", "c"->"d"))
element >> url === "/form?a=b&c=d"
}
"submit" in {
driver.getTitle === "Express Sample Title"
element.submit
driver.getTitle === ""
}
"add form data" in {
driver.navigate.back
element = (parser >> css("form")) >> asForm
driver.getTitle === "Express Sample Title"
element.addFormData("abc", "def")
element.submit
driver.getTitle === ""
val result = JsonMethods.parse(driver.getPageSource.replaceAll("<.+>", "")).asInstanceOf[JObject].values.asInstanceOf[Map[String, String]]
result === Map("text"->"default","textarea"->"","fruit"->"a","select"->"select1","abc"->"def")
}
"set uri" in {
driver.navigate.back
element = (parser >> css("form")) >> asForm
element.setUri("/abc")
element >> url === "/abc"
}
}
}
开发者ID:yuki-mt,项目名称:scraper4s,代码行数:48,代码来源:FormElementSpec.scala
注:本文中的org.json4s.JObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论