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.

get

Source

@Operator
abstract Converter get(Type type)

Returns the Converter instance used to convert the given type.

toFantom

Source

abstract Obj? toFantom(Type fantomType, Obj? mongoObj)

Converts a Mongo object to the given Fantom type.

mongoObj is nullable so converters can choose whether or not to create empty lists and maps.

toMongo

Source

abstract Obj? toMongo(Type fantomType, Obj? fantomObj)

Converts the given Fantom object to its Mongo representation.

fantomType is required in case fantomObj is null. fantomObj is nullable so converters can create empty / default objects.