Permalink
Browse files

Addendum to 973

  • Loading branch information...
1 parent ba692f9 commit 52c9825f3079e1eb2ec429a9e4f5cddaf2940624 @eltimn eltimn committed Apr 21, 2011
@@ -38,6 +38,8 @@ object MyTestEnum extends Enumeration {
}
trait HarnessedLifecycleCallbacks extends LifecycleCallbacks {
+ this: BaseField =>
+
var beforeValidationHarness: () => Unit = () => ()
override def beforeValidation = beforeValidationHarness()
var afterValidationHarness: () => Unit = () => ()
@@ -278,22 +280,16 @@ object MapTestRecord extends MapTestRecord with MongoMetaRecord[MapTestRecord] {
class LifecycleTestRecord private ()
extends MongoRecord[LifecycleTestRecord]
with MongoId[LifecycleTestRecord]
- with HarnessedLifecycleCallbacks
{
def meta = LifecycleTestRecord
def foreachCallback(f: LifecycleCallbacks => Any): Unit =
meta.foreachCallback(this, f)
- object innerObjectWithCallbacks extends LifecycleCallbacks with HarnessedLifecycleCallbacks
-
- object stringFieldWithCallbacks extends StringField(this, 100) with LifecycleCallbacks with HarnessedLifecycleCallbacks
+ object stringFieldWithCallbacks extends StringField(this, 100) with HarnessedLifecycleCallbacks
}
-object LifecycleTestRecord extends LifecycleTestRecord with MongoMetaRecord[LifecycleTestRecord] {
- // without this, the Scala 2.7 compiler panics, so don't blame me if you remove it and it's confusing!
- override def foreachCallback(inst: LifecycleTestRecord, f: LifecycleCallbacks => Any) = super.foreachCallback(inst, f)
-}
+object LifecycleTestRecord extends LifecycleTestRecord with MongoMetaRecord[LifecycleTestRecord]
/*
* SubRecord fields
@@ -159,8 +159,6 @@ object MongoRecordSpec extends Specification("MongoRecord Specification") with M
}
}
- testOneHarness("the record level", rec => rec)
- testOneHarness("the inner object level", rec => rec.innerObjectWithCallbacks: HarnessedLifecycleCallbacks)
testOneHarness("the field level", rec => rec.stringFieldWithCallbacks: HarnessedLifecycleCallbacks)
}

0 comments on commit 52c9825

Please sign in to comment.