0
val list = List(A(None,None,Some("dummyText")),
"DummmyText", None, None, None, None, None, None, Some("322"),
Some("1233"))
的情况下,I类需要将其转换为case class
如何创建列表
case class Dummy(code: A, someValue1: String, someValue2: Option[B] = None,
someValue3: Option[B] = None, someValue4: Option[B] = None,
someValue5: Option[B] = None, someValue6: Option[A] = None,
someValue7: Option[List[A]] = None, someValue8: Option[String] = None, someValue9: Option[String] = None)
我想这Instantiating a case class from a list of parameters
但不工作,因为我的List
有子类型。
是可以转换List
这样可以转换成case class
?
感谢@mavarazy。我编辑了参数。当我尝试这样做时,在“find(x => x.getName ==”)行处得到错误“play.api.http.HttpErrorHandlerExceptions $$ anon $ 1:Execution exception [[NoSuchElementException:None.get]]” “&& x.isBridge)。get。” – sowmiyaksr
我想,还有一些其他问题。我会找到确切的原因。谢谢:-) – sowmiyaksr
我得到了原因这是因为我的案例类超过22个领域。确切24场。有24种方法可以做到这一点吗? – sowmiyaksr