Class SlotKeyMap
java.lang.Object
io.mindspice.simplypages.core.SlotKeyMap
Mutable string-keyed slot value map used mainly as a legacy bridge API.
This map stores values as TypedValue to preserve runtime type metadata. For modern
rendering, prefer RenderContext and SlotKey directly.
Mutability/thread-safety: mutable and not thread-safe. Treat as request-scoped data. For reuse, stop mutating shared instances and render stable structures with per-request context data.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SlotKeyMapcreate()Factory for an empty slot map.static SlotKeyMapConverts a plain object map into a typed slot map.static SlotKeyMapfromRenderContext(RenderContext context) Legacy bridge: convert explicit entries from a render context into a string-key map.Returns the typed value wrapper forslotName, when present.<T> TgetOrDefault(String slotName, T defaultValue) Returns the stored value, ordefaultValuewhen absent.<T> Optional<T> Returns the value forslotNamecast asexpectedType.Returns an unmodifiable snapshot of internal typed values.booleanisEmpty()Returns whether the map has no entries.Storesvaluewith an explicit runtime type token.putBoolean(String slotName, Boolean value) Stores a boolean value forslotName.Stores an integer value forslotName.Stores a string value forslotName.intsize()Returns the number of stored entries.Returns a mutable plain object copy of this map's values.toRenderContext(Map<String, SlotKey<?>> slotMapping) Legacy bridge: convert this string-key map to a render context using the provided slot key mapping.withDefaults(SlotKeyMap defaults) Returns a merged copy where this map overridesdefaultsfor duplicate keys.
-
Method Details
-
create
Factory for an empty slot map. -
putString
Stores a string value forslotName. -
putBoolean
Stores a boolean value forslotName. -
putInt
Stores an integer value forslotName. -
put
Storesvaluewith an explicit runtime type token.- Parameters:
slotName- slot nametype- expected runtime type of valuevalue- value to store; may benull- Returns:
- this map
-
get
Returns the typed value wrapper forslotName, when present. -
getValue
-
getOrDefault
Returns the stored value, ordefaultValuewhen absent. -
withDefaults
Returns a merged copy where this map overridesdefaultsfor duplicate keys. -
fromMap
Converts a plain object map into a typed slot map.Entries with
nullvalues are skipped. -
fromRenderContext
Legacy bridge: convert explicit entries from a render context into a string-key map. Slot names are derived fromSlotKey.name(). -
toRenderContext
Legacy bridge: convert this string-key map to a render context using the provided slot key mapping. Entries with no matching key are ignored. -
toPlainMap
-
getValues
Returns an unmodifiable snapshot of internal typed values. -
isEmpty
public boolean isEmpty()Returns whether the map has no entries. -
size
public int size()Returns the number of stored entries.
-