Created
November 19, 2012 16:55
-
-
Save sihil/4111838 to your computer and use it in GitHub Desktop.
Type hinting when necessary doesn't seem to work for traits...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.novus.salat._ | |
import com.novus.salat.global.ctx | |
import com.mongodb.casbah.commons.MongoDBObject | |
trait TestTrait | |
case class Test(value: TestTrait) | |
case class ValueType(number: Int) extends TestTrait | |
object TestGraters { | |
val testGrater = grater[Test] | |
val testInstance = Test(ValueType(1)) | |
def tryToSerialise(): Test = { | |
val gratedDocument = testGrater.asDBObject(testInstance) | |
testGrater.asObject(new MongoDBObject(gratedDocument)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Produces a com.novus.salat.util.MissingTypeHint [NO TYPE HINT FOUND!\n\n Expected type hint key: _typeHint\n\n MAP-LIKE:\n string -> bob]