Skip to content

Instantly share code, notes, and snippets.

@rtfpessoa
Last active February 9, 2016 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtfpessoa/f4feed2ba54452d9ac1d to your computer and use it in GitHub Desktop.
Save rtfpessoa/f4feed2ba54452d9ac1d to your computer and use it in GitHub Desktop.
Scala Implicit StackOverflow
case class ModelObject(foo1: String, foo2: String, foo3: String, foo4: String, foo5: String)
case class ApiObject(bar1: String, bar3: String, bar4: String)
object ModelObject {
implicit def toApi(m: ModelObject): ApiObject = {
ApiObject(m.foo1, m.foo3, m.bar1)
}
}
ModelObject.toApi(ModelObject("1","2","3","4","5")) // bar1 ?? what ?? StackOverflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment