View Javadoc
1   package com.guinetik.hexafun.examples.sysmon;
2   
3   import com.guinetik.hexafun.hexa.AdapterKey;
4   import com.guinetik.hexafun.hexa.UseCaseKey;
5   
6   /**
7    * Type-safe keys for the system monitor use cases and adapters.
8    *
9    * <p>Centralizing keys here provides:
10   * <ul>
11   *   <li>Single source of truth for all operations</li>
12   *   <li>Compile-time type safety</li>
13   *   <li>IDE discoverability</li>
14   * </ul>
15   */
16  public final class SysmonKeys {
17  
18      private SysmonKeys() {}
19  
20      // ═══════════════════════════════════════════════════════════════════
21      //  USE CASE KEYS
22      // ═══════════════════════════════════════════════════════════════════
23  
24      /**
25       * Get CPU usage. Input: Void (no input needed), Output: Double (percentage).
26       */
27      public static final UseCaseKey<Void, Double> GET_CPU =
28          UseCaseKey.of("getCpu");
29  
30      /**
31       * Get memory usage. Input: Void, Output: Double (percentage).
32       */
33      public static final UseCaseKey<Void, Double> GET_MEMORY =
34          UseCaseKey.of("getMemory");
35  
36      /**
37       * Get disk usage. Input: Void, Output: Double (percentage).
38       */
39      public static final UseCaseKey<Void, Double> GET_DISK =
40          UseCaseKey.of("getDisk");
41  
42      /**
43       * Get all metrics at once. Input: Void, Output: SystemMetrics.
44       */
45      public static final UseCaseKey<Void, SystemMetrics> GET_ALL =
46          UseCaseKey.of("getAllMetrics");
47  
48      // ═══════════════════════════════════════════════════════════════════
49      //  ADAPTER KEYS - Transform SystemMetrics to various output formats
50      // ═══════════════════════════════════════════════════════════════════
51  
52      /**
53       * Adapt to TUI format - colorful progress bars with box drawing.
54       */
55      public static final AdapterKey<SystemMetrics, String> TO_TUI =
56          AdapterKey.of("toTui");
57  
58      /**
59       * Adapt to CLI format - plain text suitable for scripting.
60       */
61      public static final AdapterKey<SystemMetrics, String> TO_CLI =
62          AdapterKey.of("toCli");
63  
64      /**
65       * Adapt to JSON format - machine-readable output.
66       */
67      public static final AdapterKey<SystemMetrics, String> TO_JSON =
68          AdapterKey.of("toJson");
69  
70      /**
71       * Adapt to Prometheus format - metrics exposition format.
72       */
73      public static final AdapterKey<SystemMetrics, String> TO_PROMETHEUS =
74          AdapterKey.of("toPrometheus");
75  }