Package oshi.util
Class GlobalConfig
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
Nested ClassesModifier and TypeClassDescriptionstatic classIndicates that a configuration value is invalid. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Clear the configuration.static booleanGet thebooleanproperty associated with the given key.static doubleGet thedoubleproperty associated with the given key.static intGet theintproperty associated with the given key.static StringGet theStringproperty associated with the given key.static voidload(Properties properties)Load the givenPropertiesinto the global configuration.static voidReset the given property to its default value.static voidSet the given property, overwriting any existing value.
-
Method Details
-
get
Get theStringproperty 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 theintproperty 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 thedoubleproperty 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 thebooleanproperty 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 givenPropertiesinto the global configuration.- Parameters:
properties- The new properties
-