I have a case class as:
case class abc (startDate:DateTime, endDate:DateTime)
In a different object that can access this case class, instead of accessing abc.startDate or abc.endDate,
I would like to have a string that tells me whether it is start or end Date. So,
val decideStartOrEnd:String = "startDate"
Now I would like to get abc.startDate using this string variable decideStartOrEnd.
Any help is appreciated. Thanks in advance.
You can use use pattern matching in scala to obtain concrete object depends of string.
and use it like this for example
of course you can just type: