How to check which parameters of case class have default value using scala reflection 2.10

Viewed 1499

My task is to find names of parameters of case class, for which there are default values.

In 2.9 I was using ScalaSigParser from scalap and did something similar to:

(...)
case x: MethodSymbol if x.name.startsWith("init$default$") => (...)
(...)

I was hoping that reflection in 2.10 would give me easier access to this kind of information.

Eventually I'd like to write a macro, which I would include in case class' companion object, which would automatically create a code for serialization/deserialization of that case class. To do that I need to know which parameters have default values.

1 Answers
Related