Class SysmonAdapters

java.lang.Object
com.guinetik.hexafun.examples.sysmon.SysmonAdapters

public final class SysmonAdapters extends Object
Output adapters for SystemMetrics - transforms domain data to presentation formats.

This is where the hexagonal architecture shines: same domain object, four completely different presentations. The domain knows nothing about how it will be displayed.

Available Formats

  • TUI - Colorful progress bars with warnings
  • CLI - Plain text for scripting
  • JSON - Machine-readable
  • Prometheus - Metrics exposition format
  • Field Details

    • TUI_ADAPTER

      public static final Function<SystemMetrics,String> TUI_ADAPTER
      TUI format with colorful progress bars and warning indicators.
       ┌─ System Monitor ─────────────────┐
       │ CPU  [████████░░░░░░░░░░░░] 67%  │
       │ MEM  [██████████░░░░░░░░░░] 52%  │
       │ DISK [██████████████████░░] 91% ⚠│
       └──────────────────────────────────┘
       
    • CLI_ADAPTER

      public static final Function<SystemMetrics,String> CLI_ADAPTER
      CLI format - simple key: value pairs for shell scripts.
       cpu: 67%
       mem: 52%
       disk: 91%
       
    • JSON_ADAPTER

      public static final Function<SystemMetrics,String> JSON_ADAPTER
      JSON format for APIs and data interchange (pretty-printed).
       {
         "cpu": 67.0,
         "memory": 52.0,
         "disk": 91.0,
         "warnings": ["disk"]
       }
       
    • PROMETHEUS_ADAPTER

      public static final Function<SystemMetrics,String> PROMETHEUS_ADAPTER
      Prometheus exposition format for monitoring systems.
       # HELP system_cpu_percent Current CPU usage percentage
       # TYPE system_cpu_percent gauge
       system_cpu_percent 67.0
       # HELP system_memory_percent Current memory usage percentage
       # TYPE system_memory_percent gauge
       system_memory_percent 52.0
       # HELP system_disk_percent Current disk usage percentage
       # TYPE system_disk_percent gauge
       system_disk_percent 91.0