- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
case class 22 fields limit
Tue, 2011-10-11, 11:50
Many frameworks are using case casses as data holder classes for JSON or SQL tables.I have such a JSON object with more than 30 fields and I found out that there is a hard limit to 22 fields for case classes. To spilt it up into 2 (or more) case classes would not be very convenient.
I found that there where already some discussions about that: f.e. http://www.scala-lang.org/node/7910
Can someone tell the actual status of this?
Or are there some ideas to "overwrite" or work around that limit?
Cheers
--
Christophertwitter: @fakodblog: http://blog.fakod.eu
I found that there where already some discussions about that: f.e. http://www.scala-lang.org/node/7910
Can someone tell the actual status of this?
Or are there some ideas to "overwrite" or work around that limit?
Cheers
--
Christophertwitter: @fakodblog: http://blog.fakod.eu
Tue, 2011-10-11, 19:27
#2
Re: case class 22 fields limit
The best "workaround" for that is to use heterogeneous lists as
described in [1]. Try to read the other posts of the series on HLists, too.
[1]
Hi Christopher,
what about a non-case class with an appropriate unapply in its
companion object, instead? I did the same for other reasons in the
context of lift-json.
Peter