Record Class RuntimeInfo

java.lang.Object
java.lang.Record
cloud.opencode.base.core.system.RuntimeInfo
Record Components:
javaVersion - Java runtime version string - Java 运行时版本字符串
javaVendor - Java vendor - Java 厂商
javaHome - Java home directory - Java 安装目录
vmName - VM implementation name - VM 实现名称
vmVersion - VM implementation version - VM 实现版本
uptime - JVM uptime in milliseconds - JVM 运行时间(毫秒)
startTime - JVM start time as epoch milliseconds - JVM 启动时间(毫秒时间戳)
pid - process ID - 进程 ID
inputArguments - JVM input arguments (unmodifiable) - JVM 输入参数(不可修改)

public record RuntimeInfo(String javaVersion, String javaVendor, String javaHome, String vmName, String vmVersion, long uptime, long startTime, long pid, List<String> inputArguments) extends Record
Immutable snapshot of JVM runtime information. JVM 运行时信息的不可变快照。

Captures JVM version, vendor, VM details, uptime, and startup arguments at the time of creation.

捕获创建时的 JVM 版本、厂商、VM 详情、运行时间和启动参数。

Usage Examples | 使用示例:

RuntimeInfo rt = SystemInfo.runtime();
System.out.println("Java: " + rt.javaVersion());
System.out.println("VM: " + rt.vmName() + " " + rt.vmVersion());
System.out.println("Uptime: " + rt.uptime() + " ms");
System.out.println("PID: " + rt.pid());
Since:
JDK 25, opencode-base-core V1.0.3
Author:
Leon Soo
See Also:
  • Constructor Details

    • RuntimeInfo

      public RuntimeInfo(String javaVersion, String javaVendor, String javaHome, String vmName, String vmVersion, long uptime, long startTime, long pid, List<String> inputArguments)
      Compact canonical constructor with validation and defensive copy. 带验证和防御性复制的紧凑规范构造器。
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • javaVersion

      public String javaVersion()
      Returns the value of the javaVersion record component.
      Returns:
      the value of the javaVersion record component
    • javaVendor

      public String javaVendor()
      Returns the value of the javaVendor record component.
      Returns:
      the value of the javaVendor record component
    • javaHome

      public String javaHome()
      Returns the value of the javaHome record component.
      Returns:
      the value of the javaHome record component
    • vmName

      public String vmName()
      Returns the value of the vmName record component.
      Returns:
      the value of the vmName record component
    • vmVersion

      public String vmVersion()
      Returns the value of the vmVersion record component.
      Returns:
      the value of the vmVersion record component
    • uptime

      public long uptime()
      Returns the value of the uptime record component.
      Returns:
      the value of the uptime record component
    • startTime

      public long startTime()
      Returns the value of the startTime record component.
      Returns:
      the value of the startTime record component
    • pid

      public long pid()
      Returns the value of the pid record component.
      Returns:
      the value of the pid record component
    • inputArguments

      public List<String> inputArguments()
      Returns the value of the inputArguments record component.
      Returns:
      the value of the inputArguments record component