Factory design / Create objects using string
object testing extends App{
val jmap:Map[String,dime] = Map("x" -> new curr)
println(jmap("x").dimensionName)
}
class dime{
val dimensionName: Option[String] = None
}
class curr extends dime{
override val dimensionName: Option[String] = Some("curr")
val y=3432
}
class currex extends dime{
override val dimensionName: Option[String] = Some("currex")
}
No comments:
Post a Comment