Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

v4.2.0

Compare
Choose a tag to compare
@losizm losizm released this 16 Jul 22:01
d283e87

What's New?

A convenience method was added to JsonRpcMessage for getting attribute with default value.

import little.json.Implicits._
import little.json.rpc.JsonRpcRequest

val req = JsonRpcRequest.builder()
  .id(123)
  .method("compute")
  .params(Seq(1, 2, 3))
  .attributes(Map("one" -> 1, "two" -> "2"))
  .build()

assert(req.id.numberValue == 123)
assert(req.method == "compute")
assert(req.params.get.as[Seq[Int]] == Seq(1, 2, 3))
assert(req.attributes.size == 2)
assert(req.attribute[Int]("one") == 1)
assert(req.attribute[String]("two") == "2")
assert(req.getAttribute("one").contains(1))
assert(req.getAttribute("two").contains("2"))
assert(req.getAttributeOrElse("three", "xxx") == "xxx") // Added in 4.2.0