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