Skip to content

Instantly share code, notes, and snippets.

View cricri777's full-sized avatar

Christian Bruneau cricri777

View GitHub Profile
@lauris
lauris / ccToMap.scala
Created August 9, 2014 10:12
Convert case class to map in Scala
def ccToMap(cc: AnyRef) =
(Map[String, Any]() /: cc.getClass.getDeclaredFields) {
(a, f) =>
f.setAccessible(true)
a + (f.getName -> f.get(cc))
}
// Usage
case class Column(name: String,