override def reads()

in riff-raff/app/persistence/representation.scala [156:180]


    override def reads(json: JsValue): JsResult[MessageDocument] =
      (json \ "_typeHint").as[String].replace("$", "") match {
        case "persistence.DeployDocument" => JsSuccess(DeployDocument)
        case "persistence.TaskListDocument" =>
          JsSuccess(json.as[TaskListDocument])
        case "persistence.TaskRunDocument" =>
          JsSuccess(json.as[TaskRunDocument])
        case "persistence.InfoDocument" => JsSuccess(json.as[InfoDocument])
        case "persistence.CommandOutputDocument" =>
          JsSuccess(json.as[CommandOutputDocument])
        case "persistence.CommandErrorDocument" =>
          JsSuccess(json.as[CommandErrorDocument])
        case "persistence.VerboseDocument" =>
          JsSuccess(json.as[VerboseDocument])
        case "persistence.FailDocument" => JsSuccess(json.as[FailDocument])
        case "persistence.FinishContextDocument" =>
          JsSuccess(FinishContextDocument)
        case "persistence.FailContextDocument" => JsSuccess(FailContextDocument)
        case "persistence.WarningDocument" =>
          JsSuccess(json.as[WarningDocument])
        case hint =>
          throw new IllegalArgumentException(
            s"Don't know how to construct MessageDocument of type $hint"
          )
      }