Skip to content

Construct the class with dynamic default value  #340

@thinksource

Description

@thinksource

My case class is:

case class IdentityId(userId: String, providerId: String)
case class IdentityItem (
userId:String,
providerID: String,
identityId:IdentityId)

I want to set the new initial value of identityId equal to IdentityId(userId,providerID) , This is similar to C++ initialize members of a class.
the whole code is like:

case class IdentityId(userId: String, providerId: String)
case class IdentityItem (
userId:String,
providerID: String,
identityId:IdentityId=IdentityId(userId,providerID))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions