Class StatsModule

All Implemented Interfaces:
Component

public class StatsModule extends Module
Module for rendering metric/value cards in a simple grid.

Mutability and thread-safety: mutable and not thread-safe. Stats list and column count are mutable configuration state; mutate within a request-scoped flow. For reuse, stop mutating and render as a stable structure with per-request slot/context values.

  • Constructor Details

    • StatsModule

      public StatsModule()
  • Method Details

    • create

      public static StatsModule create()
    • withTitle

      public StatsModule withTitle(String title)
      Description copied from class: Module
      Sets optional title consumed by Module.buildContent() implementations.
      Overrides:
      withTitle in class Module
    • withModuleId

      public StatsModule withModuleId(String moduleId)
      Description copied from class: Module
      Sets module id and synchronizes the underlying id attribute.
      Overrides:
      withModuleId in class Module
    • addStat

      public StatsModule addStat(String value, String label)
      Adds a statistic with value and label.
      Parameters:
      value - the numeric or text value to display
      label - the label describing the statistic
    • addStat

      public StatsModule addStat(String value, String label, String description)
      Adds a statistic with value, label, and description.
      Parameters:
      value - the numeric or text value to display
      label - the label describing the statistic
      description - additional context or description
    • withColumns

      public StatsModule withColumns(int columns)
      Sets the number of columns for the stats grid.
      Parameters:
      columns - number of columns (1-6)
    • buildContent

      protected void buildContent()
      Description copied from class: Module
      Composes module structure.

      Called at most once by Module.build() unless Module.rebuildContent() is invoked. Do not rely on this method for per-request mutation.

      Specified by:
      buildContent in class Module