Int IDs. Historically these came from Android resource IDs (R.id.*) populated by AAPT2 at the consuming APK's link time — which made the integers unstable across builds and consumers, breaking compiled-AAR distribution.
components directory). The result is packaged into the APK as a name → ID map asset; at process startup the bootstrap reads that asset and calls SpatialIdRegistry.install. Generated component companions then read their IDs eagerly at companion class init via SpatialIdRegistry.component and SpatialIdRegistry.attribute.
Int fields on the companion — accesses are single field reads, with no per-access lazy delegate, no synchronization, and no allocation.
object SpatialIdRegistry
attribute
(
className
, propName
)
|
Looks up the ID for an attribute. Called from generated companion <clinit>.
Signature
fun attribute(className: String, propName: String): Int Parameters className: String
the owning component's simple class name
propName: String
the attribute's name as declared in its XML schema
Returns IntThrows IllegalStateException
if SpatialIdRegistry.install has not yet run, or if no ID was assigned for the given pair.
|
component
(
name
)
|
Looks up the ID for a component class. Called from generated companion <clinit>.
Signature
fun component(name: String): Int Parameters name: String
the component's simple class name as declared in its XML schema
Returns IntThrows IllegalStateException
if SpatialIdRegistry.install has not yet run, or if no ID was assigned for SpatialIdRegistry.component.
|
install
(
componentMap
, attributeMap
)
|
Installs the build-time name → ID maps. Called once during process bootstrap before any component companion is touched. Re-installation replaces the previous maps; this supports tests that need to swap fixtures between cases.
Signature
fun install(componentMap: Map<String, Int>, attributeMap: Map<String, Int>) Parameters componentMap: Map
simple component name (e.g. "Named") → assigned ID.
attributeMap: Map "ComponentName.attributeName" → assigned ID.
|
reset
()
|
Test-only: clears the installed maps so a subsequent SpatialIdRegistry.install starts from a clean slate.
Signature
fun reset() |