playframework / play-plugins

CachePlugin
444 stars 161 forks source link

Avoid using Map[String,List[String]] for the email context #137

Closed ggrossetie closed 10 years ago

ggrossetie commented 10 years ago

I don't see the added value of using a Map[String,List[String]] for the email context. I think this make the code harder to test and read. We are also forced to "extract" parameters from the context with this code:

context.get.toList
  .filter(_._1 startsWith key.substring(0, splitIndex)) //get the keys that have the parameter key
  .map(e=> e._1.substring(splitIndex+1)+":"+e._2.head) 

A simple class with var should be simpler no ? Something like https://gist.github.com/kencoba/1874015#file-builder-scala-L25