const mixinafMorphia::Converters
afMorphia::Converters
(Service) - Converts Fantom objects to and from their Mongo representation.
Contribute Converter
instances to this.
@Contribute { serviceType=Converters# } static Void contributeConverters(Configuration config) { config[MyType#] = MyTypeConverter() }
@uses a Configuration of Type:Converter
where Type
is what the Converter
, um, converts.
- toFantom
abstract Obj? toFantom(Type fantomType, Obj? mongoObj)
Converts a Mongo object to the given Fantom type.
mongoObj
is nullable so converters can create empty lists and maps.- toMongo
abstract Obj? toMongo(Obj? fantomObj)
Converts the given Fantom object to its Mongo representation.
If
null
is passed in, thennull
is returned.