Class MainboardService
java.lang.Object
io.github.eggy03.ferrumx.windows.service.mainboard.MainboardService
- All Implemented Interfaces:
OptionalCommonServiceInterface<Mainboard>
Service class for fetching mainboard information from the system.
This class executes the CimQuery.MAINBOARD_QUERY
PowerShell command
and maps the resulting JSON into a Mainboard
object.
Thread safety
Methods of class are not thread safe.Usage examples
// Convenience API (creates its own short-lived session)
MainboardService mainboardService = new MainboardService();
Optional<Mainboard> mainboard = mainboardService.get();
// API with re-usable session (caller manages session lifecycle)
try (PowerShell session = PowerShell.openSession()) {
MainboardService mainboardService = new MainboardService();
Optional<Mainboard> mainboard = mainboardService.get(session);
}
- Since:
- 2.0.0
- Author:
- Egg-03
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
MainboardService
public MainboardService()
-
-
Method Details
-
get
Retrieves anOptional
containing the system's mainboard information.Each invocation creates and uses a short-lived PowerShell session internally.
- Specified by:
get
in interfaceOptionalCommonServiceInterface<Mainboard>
- Returns:
- an
Optional
ofMainboard
representing the system's mainboard. - Throws:
com.google.gson.JsonSyntaxException
- if there is an error executing the PowerShell command or parsing the output.
-
get
@NotNull public @NotNull Optional<Mainboard> get(com.profesorfalken.jpowershell.PowerShell powerShell) Retrieves anOptional
containing the system's mainboard information using the caller'sPowerShell
session.- Specified by:
get
in interfaceOptionalCommonServiceInterface<Mainboard>
- Parameters:
powerShell
- an existing PowerShell session managed by the caller- Returns:
- an
Optional
ofMainboard
representing the system's mainboard. - Throws:
com.google.gson.JsonSyntaxException
- if there is an error executing the PowerShell command or parsing the output.
-