说我有这样的事情:
case class User(id:Option[Long], name: String)
case class Account(id:Option[Long], userId: Long)
object Account {
// apply method
def apply(i: Identity): Account = {
Account(None,SomeFutureUserId)
}
}
由于某种原因,这不起作用:
Account = Account(None,SomeUser.id)
我怎么让玩!知道会有Long
类型代替id
吗?像占位符这样的东西?
答案 0 :(得分:0)
试试这个:
case class User(id:Option[Long], name: String)
case class Account(id:Option[Long], userId: Option[Long])
object Account {
// apply method
def apply(i: Identity): Account = {
Account(None,None)
}
}