Class NetworkAdapterConfigurationService
java.lang.Object
io.github.eggy03.ferrumx.windows.service.network.NetworkAdapterConfigurationService
- All Implemented Interfaces:
CommonServiceInterface<NetworkAdapterConfiguration>
public class NetworkAdapterConfigurationService
extends Object
implements CommonServiceInterface<NetworkAdapterConfiguration>
Service class for fetching network adapter configuration information from the system.
This class executes the CimQuery.NETWORK_ADAPTER_CONFIGURATION_QUERY PowerShell command
and maps the resulting JSON into a list of NetworkAdapterConfiguration objects.
Thread safety
Methods of class are not thread safe.Usage examples
// Convenience API (creates its own short-lived session)
NetworkAdapterConfigurationService configService = new NetworkAdapterConfigurationService();
List<NetworkAdapterConfiguration> configs = configService.get();
// API with re-usable session (caller manages session lifecycle)
try (PowerShell session = PowerShell.openSession()) {
NetworkAdapterConfigurationService configService = new NetworkAdapterConfigurationService();
List<NetworkAdapterConfiguration> configs = configService.get(session);
}
- Since:
- 2.0.0
- Author:
- Egg-03
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull List<NetworkAdapterConfiguration> get()Retrieves a list of network adapter configurations present in the system.@NotNull List<NetworkAdapterConfiguration> get(com.profesorfalken.jpowershell.PowerShell powerShell) Retrieves a list of network adapter configurations using the caller'sPowerShellsession.
-
Constructor Details
-
NetworkAdapterConfigurationService
public NetworkAdapterConfigurationService()
-
-
Method Details
-
get
Retrieves a list of network adapter configurations present in the system.Each invocation creates and uses a short-lived PowerShell session internally.
- Specified by:
getin interfaceCommonServiceInterface<NetworkAdapterConfiguration>- Returns:
- a list of
NetworkAdapterConfigurationobjects representing the system's network adapters. Returns an empty list if no configurations are detected.
-
get
@NotNull public @NotNull List<NetworkAdapterConfiguration> get(com.profesorfalken.jpowershell.PowerShell powerShell) Retrieves a list of network adapter configurations using the caller'sPowerShellsession.- Specified by:
getin interfaceCommonServiceInterface<NetworkAdapterConfiguration>- Parameters:
powerShell- an existing PowerShell session managed by the caller- Returns:
- a list of
NetworkAdapterConfigurationobjects representing the system's network adapters. Returns an empty list if no configurations are detected.
-