sourceafQuickFlux::EntityMetaSrc.fan

using afIoc::Inject
using afIoc::Registry

const class EntityMetaSrc {

    @Inject
    private const Registry      registry
    private const StrategyStash stash
    
    new make(Type:Type src, |This| inject) {
        inject(this)
        stash = StrategyStash(src)
    }
    
    EntityMeta toMeta(Entity entity, Entity:EntityMeta metaMap) {
        metaType := stash.findByInstance(entity) as Type
        return registry.autobuild(metaType, [entity, metaMap])
    }
}