14
14
* limitations under the License.
15
15
*/
16
16
17
- package net .liftweb
18
- package mongodb
19
- package record
20
- package fixtures
17
+ package net .liftweb
18
+ package mongodb
19
+ package record
20
+ package fixtures
21
21
22
22
import field ._
23
23
@@ -133,7 +133,7 @@ class FieldTypeTestRecord private () extends MongoRecord[FieldTypeTestRecord] wi
133
133
object optionalTimeZoneField extends OptionalTimeZoneField (this )
134
134
135
135
override def equals (other : Any ): Boolean = other match {
136
- case that: FieldTypeTestRecord =>
136
+ case that : FieldTypeTestRecord =>
137
137
this .id.value == that.id.value &&
138
138
// this.mandatoryBinaryField.value == that.mandatoryBinaryField.value &&
139
139
this .mandatoryBooleanField.value == that.mandatoryBooleanField.value &&
@@ -198,7 +198,7 @@ class MongoFieldTypeTestRecord private () extends MongoRecord[MongoFieldTypeTest
198
198
object legacyOptionalUUIDField extends UUIDField (this ) { override def optional_? = true }
199
199
200
200
override def equals (other : Any ): Boolean = other match {
201
- case that: MongoFieldTypeTestRecord =>
201
+ case that : MongoFieldTypeTestRecord =>
202
202
this .id.value == that.id.value &&
203
203
this .mandatoryDateField.value == that.mandatoryDateField.value &&
204
204
this .mandatoryJsonObjectField.value == that.mandatoryJsonObjectField.value &&
@@ -238,7 +238,7 @@ class ListTestRecord private () extends MongoRecord[ListTestRecord] with UUIDPk[
238
238
// TODO: More List types
239
239
240
240
override def equals (other : Any ): Boolean = other match {
241
- case that: ListTestRecord =>
241
+ case that : ListTestRecord =>
242
242
this .id.value == that.id.value &&
243
243
this .mandatoryStringListField.value == that.mandatoryStringListField.value &&
244
244
this .mandatoryIntListField.value == that.mandatoryIntListField.value &&
@@ -250,7 +250,7 @@ object ListTestRecord extends ListTestRecord with MongoMetaRecord[ListTestRecord
250
250
override def formats = allFormats
251
251
}
252
252
253
- class MapTestRecord extends MongoRecord [MapTestRecord ] with StringPk [MapTestRecord ] {
253
+ class MapTestRecord private () extends MongoRecord [MapTestRecord ] with StringPk [MapTestRecord ] {
254
254
def meta = MapTestRecord
255
255
256
256
object mandatoryStringMapField extends MongoMapField [MapTestRecord , String ](this )
@@ -262,7 +262,7 @@ class MapTestRecord extends MongoRecord[MapTestRecord] with StringPk[MapTestReco
262
262
// TODO: More Map types, including JsonObject (will require a new Field type)
263
263
264
264
override def equals (other : Any ): Boolean = other match {
265
- case that: MapTestRecord =>
265
+ case that : MapTestRecord =>
266
266
this .id.value == that.id.value &&
267
267
this .mandatoryStringMapField.value == that.mandatoryStringMapField.value &&
268
268
this .mandatoryIntMapField.value == that.mandatoryIntMapField.value
@@ -290,7 +290,7 @@ object LifecycleTestRecord extends LifecycleTestRecord with MongoMetaRecord[Life
290
290
/*
291
291
* SubRecord fields
292
292
*/
293
- class SubRecord extends BsonRecord [SubRecord ] {
293
+ class SubRecord private () extends BsonRecord [SubRecord ] {
294
294
def meta = SubRecord
295
295
296
296
object name extends StringField (this , 12 )
@@ -304,21 +304,21 @@ class SubRecord extends BsonRecord[SubRecord] {
304
304
object uuid extends UUIDField (this )
305
305
306
306
override def equals (other : Any ): Boolean = other match {
307
- case that: SubRecord => this .toString == that.toString
307
+ case that : SubRecord => this .toString == that.toString
308
308
case _ => false
309
309
}
310
310
}
311
311
object SubRecord extends SubRecord with BsonMetaRecord [SubRecord ] {
312
312
override def formats = allFormats
313
313
}
314
314
315
- class SubSubRecord extends BsonRecord [SubSubRecord ] {
315
+ class SubSubRecord private () extends BsonRecord [SubSubRecord ] {
316
316
def meta = SubSubRecord
317
317
318
318
object name extends StringField (this , 12 )
319
319
320
320
override def equals (other : Any ): Boolean = other match {
321
- case that: SubSubRecord =>
321
+ case that : SubSubRecord =>
322
322
this .name.value == that.name.value
323
323
case _ => false
324
324
}
@@ -327,7 +327,7 @@ object SubSubRecord extends SubSubRecord with BsonMetaRecord[SubSubRecord] {
327
327
override def formats = allFormats
328
328
}
329
329
330
- class SubRecordTestRecord extends MongoRecord [SubRecordTestRecord ] with ObjectIdPk [SubRecordTestRecord ] {
330
+ class SubRecordTestRecord private () extends MongoRecord [SubRecordTestRecord ] with ObjectIdPk [SubRecordTestRecord ] {
331
331
def meta = SubRecordTestRecord
332
332
333
333
object mandatoryBsonRecordField extends BsonRecordField (this , SubRecord )
@@ -341,7 +341,7 @@ class SubRecordTestRecord extends MongoRecord[SubRecordTestRecord] with ObjectId
341
341
}
342
342
343
343
override def equals (other : Any ): Boolean = other match {
344
- case that: SubRecordTestRecord => this .toString == that.toString
344
+ case that : SubRecordTestRecord => this .toString == that.toString
345
345
case _ => false
346
346
}
347
347
@@ -355,7 +355,7 @@ case class JsonObj(id: String, name: String) extends JsonObject[JsonObj] {
355
355
}
356
356
object JsonObj extends JsonObjectMeta [JsonObj ]
357
357
358
- class NullTestRecord extends MongoRecord [NullTestRecord ] with IntPk [NullTestRecord ] {
358
+ class NullTestRecord private () extends MongoRecord [NullTestRecord ] with IntPk [NullTestRecord ] {
359
359
360
360
def meta = NullTestRecord
361
361
@@ -367,6 +367,11 @@ class NullTestRecord extends MongoRecord[NullTestRecord] with IntPk[NullTestReco
367
367
def defaultValue = JsonObj (" 1" , null )
368
368
}
369
369
object jsonobjlist extends MongoJsonObjectListField [NullTestRecord , JsonObj ](this , JsonObj )
370
+
371
+ override def equals (other : Any ): Boolean = other match {
372
+ case that : NullTestRecord => this .toString == that.toString
373
+ case _ => false
374
+ }
370
375
}
371
376
372
377
object NullTestRecord extends NullTestRecord with MongoMetaRecord [NullTestRecord ]
@@ -377,15 +382,36 @@ extends JsonObject[BoxTestJsonObj] {
377
382
}
378
383
object BoxTestJsonObj extends JsonObjectMeta [BoxTestJsonObj ]
379
384
380
- class BoxTestRecord extends MongoRecord [BoxTestRecord ] with LongPk [BoxTestRecord ] {
385
+ class BoxTestRecord private () extends MongoRecord [BoxTestRecord ] with LongPk [BoxTestRecord ] {
381
386
def meta = BoxTestRecord
382
387
383
388
object jsonobj extends JsonObjectField [BoxTestRecord , BoxTestJsonObj ](this , BoxTestJsonObj ) {
384
389
def defaultValue = BoxTestJsonObj (" 0" , Empty , Full (" Full String" ), Failure (" Failure" ))
385
390
}
386
391
object jsonobjlist extends MongoJsonObjectListField [BoxTestRecord , BoxTestJsonObj ](this , BoxTestJsonObj )
392
+
393
+ override def equals (other : Any ): Boolean = other match {
394
+ case that : BoxTestRecord => this .toString == that.toString
395
+ case _ => false
396
+ }
387
397
}
388
398
object BoxTestRecord extends BoxTestRecord with MongoMetaRecord [BoxTestRecord ] {
389
399
override def formats = super .formats + new JsonBoxSerializer
390
400
}
391
401
402
+ /*
403
+ * MongoRefFields
404
+ */
405
+ class RefFieldTestRecord private () extends MongoRecord [RefFieldTestRecord ] with ObjectIdPk [RefFieldTestRecord ] {
406
+ def meta = RefFieldTestRecord
407
+
408
+ object mandatoryObjectIdRefField extends ObjectIdRefField (this , FieldTypeTestRecord )
409
+ object mandatoryUUIDRefField extends UUIDRefField (this , ListTestRecord )
410
+ object mandatoryStringRefField extends StringRefField (this , MapTestRecord , 100 )
411
+ object mandatoryIntRefField extends IntRefField (this , NullTestRecord )
412
+ object mandatoryLongRefField extends LongRefField (this , BoxTestRecord )
413
+ }
414
+
415
+ object RefFieldTestRecord extends RefFieldTestRecord with MongoMetaRecord [RefFieldTestRecord ] {
416
+ override def formats = allFormats
417
+ }
0 commit comments