Class WmiQueryExecutorJNA

java.lang.Object
oshi.util.platform.windows.WmiQueryExecutorJNA
All Implemented Interfaces:
WmiQueryExecutor

public class WmiQueryExecutorJNA extends Object implements WmiQueryExecutor
Adapts the JNA WmiQueryHandler to the common WmiQueryExecutor interface.
  • Constructor Details

    • WmiQueryExecutorJNA

      public WmiQueryExecutorJNA(WmiQueryHandler handler)
      Creates an executor wrapping the given handler.
      Parameters:
      handler - the JNA WMI query handler
  • Method Details

    • createInstance

      public static WmiQueryExecutorJNA createInstance()
      Creates an executor using a new default handler instance.
      Returns:
      a new executor, or null if handler creation fails
    • getHandler

      public WmiQueryHandler getHandler()
      Returns the underlying JNA handler, for COM init/uninit operations.
      Returns:
      the JNA handler
    • queryWMI

      public <T extends Enum<T>> WmiResult<T> queryWMI(WmiQuery<T> query)
      Description copied from interface: WmiQueryExecutor
      Query WMI for values. Initializes and uninitializes COM for each query.
      Specified by:
      queryWMI in interface WmiQueryExecutor
      Type Parameters:
      T - the enum type for the query properties
      Parameters:
      query - the WMI query
      Returns:
      the query results
    • queryWMI

      public <T extends Enum<T>> WmiResult<T> queryWMI(WmiQuery<T> query, boolean initCom)
      Description copied from interface: WmiQueryExecutor
      Query WMI for values.
      Specified by:
      queryWMI in interface WmiQueryExecutor
      Type Parameters:
      T - the enum type for the query properties
      Parameters:
      query - the WMI query
      initCom - whether to initialize COM for this query. If false, assumes COM is already initialized.
      Returns:
      the query results