Class WmiUtil
java.lang.Object
oshi.driver.common.windows.wmi.WmiUtil
Helper class for extracting typed values from
WmiResult objects.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetDateString(WmiResult<T> result, T property, int index) Gets a Date value from a WmiResult as a String in ISO 8601 format.static <T extends Enum<T>>
OffsetDateTimegetDateTime(WmiResult<T> result, T property, int index) Gets a DateTime value from a WmiResult as an OffsetDateTime.static <T extends Enum<T>>
floatGets a Float value from a WmiResult.getRefString(WmiResult<T> result, T property, int index) Gets a Reference value from a WmiResult as a String.static <T extends Enum<T>>
intGets a Sint32 value from a WmiResult.Gets a String value from a WmiResult.static <T extends Enum<T>>
intGets a Uint16 value from a WmiResult.static <T extends Enum<T>>
intGets an UINT32 value from a WmiResult.static <T extends Enum<T>>
longgetUint32asLong(WmiResult<T> result, T property, int index) Gets an UINT32 value from a WmiResult as a long, preserving the unsignedness.static <T extends Enum<T>>
longGets a Uint64 value from a WmiResult (parsing the String).queryToString(WmiQuery<T> query) Translate a WmiQuery to the actual query string.
-
Field Details
-
OHM_NAMESPACE
The namespace where Open Hardware Monitor publishes to WMI.- See Also:
-
LHM_NAMESPACE
The namespace where LibreHardwareMonitor publishes to WMI.- See Also:
-
-
Method Details
-
queryToString
-
getString
Gets a String value from a WmiResult.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, an empty-string otherwise
-
getDateString
Gets a Date value from a WmiResult as a String in ISO 8601 format.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, an empty-string otherwise
-
getDateTime
public static <T extends Enum<T>> OffsetDateTime getDateTime(WmiResult<T> result, T property, int index) Gets a DateTime value from a WmiResult as an OffsetDateTime.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, otherwise
Constants.UNIX_EPOCH
-
getRefString
Gets a Reference value from a WmiResult as a String.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, an empty-string otherwise
-
getUint64
Gets a Uint64 value from a WmiResult (parsing the String).- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null and parseable as a long, 0 otherwise
-
getUint32
Gets an UINT32 value from a WmiResult.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, 0 otherwise
-
getUint32asLong
Gets an UINT32 value from a WmiResult as a long, preserving the unsignedness.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, 0 otherwise
-
getSint32
Gets a Sint32 value from a WmiResult.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, 0 otherwise
-
getUint16
Gets a Uint16 value from a WmiResult.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, 0 otherwise
-
getFloat
Gets a Float value from a WmiResult.- Type Parameters:
T- the property enum type- Parameters:
result- The WmiResult from which to fetch the valueproperty- The property (column) to fetchindex- The index (row) to fetch- Returns:
- The stored value if non-null, 0 otherwise
-