I have just shifted to the scala and there I have the Map object as per the below structure.
object report {
def report_sn(flag : Boolean = false) : Map[String, Map[String,Any]] = Map(
"100"->Map("reportName"->"XYZ",
"queryColumns"->Array("title", "startDate", "endDate"),
"groupBy"->Array(),
"groupByFunctions"->Array(),
"query"->("SELECT * "+
"FROM "+
" abctable limit 10 "),
"queryParams"->Array(),
"xmlTemplate"->"xyz",
"processFunction"->"pqrFun"
),
"101"-> Map("reportName"->"XYZ1",
"queryColumns"->Array("title", "startDate", "endDate"),
"groupBy"->Array(),
"groupByFunctions"->Array(),
"query"->("SELECT * "+
"FROM "+
" abc1table limit 10 "),
"queryParams"->Array(),
"xmlTemplate"->"xyz1",
"processFunction"->"pqr1Fun"
)
)
Like this, I have 1000s of query details in this map object.
I am looking for a way to use some other objects to make it more readable and understandable code.
As commented by @LuisMiguelMejíaSuárez, you could use a
case classinstead of aMap[String, Any]and it will be more readable and better typed.Something like this: