Class Slot<T>

java.lang.Object
io.mindspice.simplypages.core.Slot<T>
Type Parameters:
T - slot value type
All Implemented Interfaces:
Component

public class Slot<T> extends Object implements Component
Component placeholder that renders the value for a SlotKey from a RenderContext.

Rendering contract:

- missing value: renders empty string

- value is Component: delegates to that component's render path

- all other values: HTML-escapes toString()

- compiled entries are trusted HTML; explicit live values may be cached by context policy

- applies equally for direct component rendering and Template rendering

Mutability/thread-safety: immutable after construction and thread-safe.

  • Method Details

    • of

      public static <T> Slot<T> of(SlotKey<T> key)
      Factory for a slot bound to key.
    • getKey

      public SlotKey<T> getKey()
      Returns the key resolved at render time.
    • render

      public String render(RenderContext context)
      Renders the current slot value using the supplied context.
      Specified by:
      render in interface Component
      Parameters:
      context - context used for slot resolution and render policy
      Returns:
      rendered HTML for this component