object {{ bridge_obj }} {
    private val registered = mutableMapOf<String, {{ interface_name }}>()

{% if has_super_trait %}
    fun register(impl: {{ interface_name }}): Unit {
        val name = impl.name()
{% else %}
    fun register(impl: {{ interface_name }}, name: String): Unit {
{% endif %}
        registered[name] = impl
        {{ bridge_class_name }}.{{ register_native_fn }}({% if has_super_trait %}impl{% else %}impl, name{% endif %})
    }

{% if unregister_native_fn %}
    fun unregister(name: String): Unit {
        registered.remove(name)
        {{ bridge_class_name }}.{{ unregister_native_fn }}(name)
    }

{% endif %}
{% if clear_native_fn %}
    fun clearAll(): Unit {
        registered.clear()
        {{ bridge_class_name }}.{{ clear_native_fn }}()
    }

{% endif %}
    fun getAll(): Map<String, {{ interface_name }}> = registered.toMap()
}
