This should work:
def getCCParams(cc: AnyRef) =
cc.getClass.getDeclaredFields.foldLeft(Map.empty[String, Any]) { (a, f) =>
f.setAccessible(true)
a + (f.getName -> f.get(cc))
}
More Related Contents:
- Case objects vs Enumerations in Scala
- Cleaner way to update nested structures
- Case class equality in Apache Spark
- What is the difference between Scala’s case class and class?
- How to define schema for custom type in Spark SQL?
- How to override apply in a case class companion
- How to get around the Scala case class limit of 22 fields?
- Mixing in a trait dynamically
- Easy idiomatic way to define Ordering for a simple case class
- Scala Macros: Making a Map out of fields of a class in Scala
- What is *so* wrong with case class inheritance?
- Scala case class inheritance
- Overload constructor for Scala’s Case Classes?
- Why is parameter in contravariant position?
- Should I use the final modifier when declaring case classes?
- Scala 2.10 reflection, how do I extract the field values from a case class, i.e. field list from case class
- “dynamically” creating case classes with macros
- How is this case class match pattern working?
- Read entire file in Scala?
- How can I pass extra parameters to UDFs in Spark SQL?
- Scala Futures – built in timeout?
- Functional programming, Scala map and fold left [closed]
- What does => and () => mean in Scala [duplicate]
- Load Scala file into interpreter to use functions?
- Any reason why scala does not explicitly support dependent types?
- Apache Spark, add an “CASE WHEN … ELSE …” calculated column to an existing DataFrame
- Scala: pass Seq to var-args functions
- Scala-Spark Dynamically call groupby and agg with parameter values
- Joining two dataframes without a common column
- Scala best way of turning a Collection into a Map-by-key?