I have scala class like:
@Entity("users")
class User(@Required val cid: String, val isAdmin: Boolean = false, @Required val dateJoined: Date = new Date() ) {
@Id var id: ObjectId = _
@Reference
val foos = new ArrayList[Foo]
}
If it was a Java class I would simply put implements java.io.Serializable but this does not work in scala. Also is foos as declared above is private or public?
How do I use a @serializable scala object?
foos is public unless marked otherwise
scala 2.9.x also have an interface named Serializable, you may extends or mixin this. before 2.9.x the @serializable is the only choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With