ConvertMap

ceramic.ConvertMap (Class)
Implements: ConvertField

Converter for Map fields in fragments and data serialization.

This converter handles Map<String,T> instances by converting between DynamicAccess objects (JavaScript-style objects) and Haxe Map instances. This allows maps to be serialized as plain objects in JSON and other serialization formats.

Instance Members

basicToField(instance: Entity, field: String, assets: Assets, basic: haxe.DynamicAccess<ceramic.ConvertMap.T>, done: Function): Void

Convert a DynamicAccess object to a Map instance.

Iterates through all keys in the dynamic object and creates corresponding entries in a new Map instance.

Name Type Description
instance Entity The entity that owns this field
field String The name of the field being converted
assets Assets Assets instance for resource loading (unused for maps)
basic haxe.DynamicAccess<ceramic.ConvertMap.T> The DynamicAccess object to convert
done Function Callback invoked with the converted Map instance

fieldToBasic(instance: Entity, field: String, value: Map): haxe.DynamicAccess<ceramic.ConvertMap.T>

Convert a Map instance to a DynamicAccess object for serialization.

Iterates through all entries in the map and creates corresponding properties in a new DynamicAccess object.

Name Type Description
instance Entity The entity that owns this field
field String The name of the field being converted
value Map The Map instance to convert
Returns Description
haxe.DynamicAccess<ceramic.ConvertMap.T> A DynamicAccess object containing all map entries

new(): Void

Create a new map converter instance.