Class SystemInfoFactory
java.lang.Object
oshi.spi.SystemInfoFactory
Factory that uses
ServiceLoader to discover and select the best available SystemInfoProvider.
When both oshi-core (JNA) and oshi-core-ffm (FFM) are declared as dependencies, this factory
discovers their SystemInfoProvider implementations via ServiceLoader, filters by
availability, and selects the one with the highest
priority.
Usage:
SystemInfoProvider si = SystemInfoFactory.create();
HardwareAbstractionLayer hal = si.getHardware();
OperatingSystem os = si.getOperatingSystem();
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic SystemInfoProvidercreate()Creates a newSystemInfoProviderinstance using the best available provider.
-
Method Details
-
create
Creates a newSystemInfoProviderinstance using the best available provider.Providers are discovered via
ServiceLoaderand filtered bySystemInfoProvider.isAvailable(). Among available providers, the one with the highestSystemInfoProvider.getPriority()is selected.- Returns:
- a new instance of the best available
SystemInfoProvider - Throws:
IllegalStateException- if no available provider is found. Ensureoshi-core,oshi-core-ffm, or (on Linux)oshi-commonalone is on the classpath.
-