Class WqlResult

java.lang.Object
org.metricshub.winrm.WqlResult
All Implemented Interfaces:
Iterable<WqlRow>

public final class WqlResult extends Object implements Iterable<WqlRow>
The complete result of a WQL query: the rows, the column names in query order, and the time the query took. Iterable, so it can be consumed directly:

 for (WqlRow row : client.wql("SELECT Name, State FROM Win32_Service").execute()) {
 	System.out.println(row.string("Name"));
 }
 
  • Method Details

    • columns

      public List<String> columns()
      Get the column names, in the order they appear in the WQL query (SELECT * yields the order the server returned).
      Returns:
      an unmodifiable list of column names
    • rows

      public List<WqlRow> rows()
      Get the result rows.
      Returns:
      an unmodifiable list of rows
    • size

      public int size()
      Get the number of rows.
      Returns:
      the row count
    • isEmpty

      public boolean isEmpty()
      Whether the query returned no rows.
      Returns:
      true when the result is empty
    • elapsed

      public Duration elapsed()
      Get the time the query took, from request to complete result.
      Returns:
      the elapsed time
    • iterator

      public Iterator<WqlRow> iterator()
      Specified by:
      iterator in interface Iterable<WqlRow>
    • toString

      public String toString()
      Overrides:
      toString in class Object