java.lang.Object
oshi.util.GlobalConfig
The global configuration utility. See
src/main/resources/oshi.properties
for default values.
This class is not thread safe if methods manipulating the configuration are used. These methods are intended for use by a single thread at startup, before instantiation of any other OSHI classes. OSHI does not guarantee re- reading of any configuration changes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Indicates that a configuration value is invalid. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear()
Clear the configuration.static String
Get the property associated with the given key.static boolean
Get theboolean
property associated with the given key.static double
Get thedouble
property associated with the given key.static int
Get theint
property associated with the given key.static String
Get theString
property associated with the given key.static void
load
(Properties properties) Load the givenProperties
into the global configuration.static void
Reset the given property to its default value.static void
Set the given property, overwriting any existing value.
-
Field Details
-
OSHI_UTIL_MEMOIZER_EXPIRATION
- See Also:
-
OSHI_UTIL_WMI_TIMEOUT
- See Also:
-
OSHI_UTIL_PROC_PATH
- See Also:
-
OSHI_UTIL_SYS_PATH
- See Also:
-
OSHI_UTIL_DEV_PATH
- See Also:
-
OSHI_PSEUDO_FILESYSTEM_TYPES
- See Also:
-
OSHI_NETWORK_FILESYSTEM_TYPES
- See Also:
-
OSHI_OS_LINUX_ALLOWUDEV
- See Also:
-
OSHI_OS_LINUX_PROCFS_LOGWARNING
- See Also:
-
OSHI_OS_MAC_SYSCTL_LOGWARNING
- See Also:
-
OSHI_OS_WINDOWS_EVENTLOG
- See Also:
-
OSHI_OS_WINDOWS_PROCSTATE_SUSPENDED
- See Also:
-
OSHI_OS_WINDOWS_COMMANDLINE_BATCH
- See Also:
-
OSHI_OS_WINDOWS_HKEYPERFDATA
- See Also:
-
OSHI_OS_WINDOWS_LEGACY_SYSTEM_COUNTERS
- See Also:
-
OSHI_OS_WINDOWS_LOADAVERAGE
- See Also:
-
OSHI_OS_WINDOWS_CPU_UTILITY
- See Also:
-
OSHI_OS_WINDOWS_PERFDISK_DIABLED
- See Also:
-
OSHI_OS_WINDOWS_PERFOS_DIABLED
- See Also:
-
OSHI_OS_WINDOWS_PERFPROC_DIABLED
- See Also:
-
OSHI_OS_WINDOWS_PERF_DISABLE_ALL_ON_FAILURE
- See Also:
-
OSHI_OS_UNIX_WHOCOMMAND
- See Also:
-
OSHI_OS_SOLARIS_ALLOWKSTAT2
- See Also:
-
-
Method Details
-
get
Get the property associated with the given key.- Parameters:
key
- The property key- Returns:
- The property value if it exists, or null otherwise
-
get
Get theString
property associated with the given key.- Parameters:
key
- The property keydef
- The default value- Returns:
- The property value or the given default if not found
-
get
Get theint
property associated with the given key.- Parameters:
key
- The property keydef
- The default value- Returns:
- The property value or the given default if not found
-
get
Get thedouble
property associated with the given key.- Parameters:
key
- The property keydef
- The default value- Returns:
- The property value or the given default if not found
-
get
Get theboolean
property associated with the given key.- Parameters:
key
- The property keydef
- The default value- Returns:
- The property value or the given default if not found
-
set
Set the given property, overwriting any existing value. If the given value isnull
, the property is removed.- Parameters:
key
- The property keyval
- The new value
-
remove
Reset the given property to its default value.- Parameters:
key
- The property key
-
clear
public static void clear()Clear the configuration. -
load
Load the givenProperties
into the global configuration.- Parameters:
properties
- The new properties
-