Interface WmiQueryExecutor
- All Known Implementing Classes:
WmiQueryExecutorJNA, WmiQueryHandler
public interface WmiQueryExecutor
Common interface for executing WMI queries, abstracting JNA and FFM implementations.
JNA users who wish to customize COM initialization (e.g., to avoid per-query COM init/uninit overhead) should extend
oshi.util.platform.windows.WmiQueryHandler in the oshi-core module. See the oshi-demo module
for examples.
-
Method Summary
Modifier and TypeMethodDescriptionstatic WmiQueryExecutorCreates a new instance of the platform-appropriate WMI query executor.Query WMI for values.Query WMI for values.
-
Method Details
-
queryWMI
-
queryWMI
Query WMI for values.- Type Parameters:
T- the enum type for the query properties- Parameters:
query- the WMI queryinitCom- whether to initialize COM for this query. Iffalse, assumes COM is already initialized.- Returns:
- the query results
-
createInstance
Creates a new instance of the platform-appropriate WMI query executor.On JNA, this returns an instance of
WmiQueryHandler(or a user-configured subclass). On FFM, this returns an instance ofWmiQueryHandlerFFM.- Returns:
- a new executor instance, or
nullif creation fails
-