Interface SystemInfoProvider
- All Known Implementing Classes:
SystemInfo
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 Summary
Modifier and TypeMethodDescriptionCreates a new instance of the appropriate platform-specificHardwareAbstractionLayer.Creates a new instance of the appropriate platform-specificOperatingSystem.intReturns the priority of this provider.booleanReturns whether this provider is available in the current runtime environment.
-
Method Details
-
getOperatingSystem
OperatingSystem getOperatingSystem()Creates a new instance of the appropriate platform-specificOperatingSystem.- Returns:
- A new instance of
OperatingSystem.
-
getHardware
HardwareAbstractionLayer getHardware()Creates a new instance of the appropriate platform-specificHardwareAbstractionLayer.- 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:
trueif this provider can be used in the current environment
-