Interface SystemInfoProvider

All Known Implementing Classes:
SystemInfo

@PublicApi public interface SystemInfoProvider
Service Provider Interface for OSHI's SystemInfo entry points.

Implementations are discovered via ServiceLoader. When multiple providers are available (e.g., both oshi-core and oshi-core-ffm on the classpath), SystemInfoFactory selects the best available provider based on getPriority() and isAvailable().

See Also:
  • Method Details

    • getOperatingSystem

      OperatingSystem getOperatingSystem()
      Creates a new instance of the appropriate platform-specific OperatingSystem.
      Returns:
      A new instance of OperatingSystem.
    • getHardware

      Creates a new instance of the appropriate platform-specific HardwareAbstractionLayer.
      Returns:
      A new instance of HardwareAbstractionLayer.
    • getPriority

      int getPriority()
      Returns the priority of this provider. Higher values indicate higher priority. When multiple providers are available, the one with the highest priority is selected.

      Priority 0 is reserved for a potential future no-native-access fallback. The JNA-based provider (oshi-core) returns 10. The FFM-based provider (oshi-core-ffm) returns 20 (preferred when available).

      Returns:
      the priority of this provider
    • isAvailable

      boolean isAvailable()
      Returns whether this provider is available in the current runtime environment.

      A provider may be unavailable if the current platform is not supported or if required runtime features (such as the FFM API on JDK 25+) are not present.

      Returns:
      true if this provider can be used in the current environment