The Properties Class
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
2 min read
A PropertiesPropertiesPropertiesPropertiesPropertiesPropertiesProperties object, or property set, is a collection of properties. Each communicator has a property set, which its getPropertiesgetPropertiesgetPropertiesgetPropertiesgetPropertiesgetPropertiesgetProperties method returns. You can also create a property set yourself, for example to configure a new communicator.
Reading and Setting a Property
getPropertygetPropertygetPropertygetPropertygetPropertygetPropertygetProperty, getPropertyAsIntgetPropertyAsIntgetPropertyAsIntgetPropertyAsIntgetPropertyAsIntgetPropertyAsIntgetPropertyAsInt, and getPropertyAsListgetPropertyAsListgetPropertyAsListgetPropertyAsListgetPropertyAsListgetPropertyAsListgetPropertyAsList read a property as a string, an integer, or a list of strings. Their WithDefault variants, getPropertyWithDefaultgetPropertyWithDefaultgetPropertyWithDefaultgetPropertyWithDefaultgetPropertyWithDefaultgetPropertyWithDefaultgetPropertyWithDefault, getPropertyAsIntWithDefaultgetPropertyAsIntWithDefaultgetPropertyAsIntWithDefaultgetPropertyAsIntWithDefaultgetPropertyAsIntWithDefaultgetPropertyAsIntWithDefaultgetPropertyAsIntWithDefault, and getPropertyAsListWithDefaultgetPropertyAsListWithDefaultgetPropertyAsListWithDefaultgetPropertyAsListWithDefaultgetPropertyAsListWithDefaultgetPropertyAsListWithDefaultgetPropertyAsListWithDefault, return the default you give for a property that is not set.
setPropertysetPropertysetPropertysetPropertysetPropertysetPropertysetProperty sets a property, and applies the property validation rules.
Reading an Ice Property
An Ice property is a property that Ice defines, such as Ice.Warn.Dispatch: its name begins with a reserved prefix, and the property reference lists it with its default value. getIcePropertygetIcePropertygetIcePropertygetIcePropertygetIcePropertygetIcePropertygetIceProperty, getIcePropertyAsIntgetIcePropertyAsIntgetIcePropertyAsIntgetIcePropertyAsIntgetIcePropertyAsIntgetIcePropertyAsIntgetIcePropertyAsInt, and getIcePropertyAsListgetIcePropertyAsListgetIcePropertyAsListgetIcePropertyAsListgetIcePropertyAsListgetIcePropertyAsListgetIcePropertyAsList read an Ice property and, unlike the plain getProperty methods, return its default value when it is not set. For example, if you never set Ice.Warn.Dispatch, getIcePropertyAsInt("Ice.Warn.Dispatch") returns its default of 1, while getPropertyAsInt("Ice.Warn.Dispatch") returns 0.
These three methods accept only the names of Ice properties. Read the other properties, such as the properties of an object adapter or a proxy, with the plain getProperty methods, which take any name.
Reading and Parsing Groups of Properties
getPropertiesForPrefixgetPropertiesForPrefixgetPropertiesForPrefixgetPropertiesForPrefixgetPropertiesForPrefixgetPropertiesForPrefixgetPropertiesForPrefix returns the properties whose names begin with a prefix, and marks them as used. parseCommandLineOptionsparseCommandLineOptionsparseCommandLineOptionsparseCommandLineOptionsparseCommandLineOptionsparseCommandLineOptionsparseCommandLineOptions and parseIceCommandLineOptionsparseIceCommandLineOptionsparseIceCommandLineOptionsparseIceCommandLineOptionsparseIceCommandLineOptionsparseIceCommandLineOptionsparseIceCommandLineOptions convert command-line arguments of the form --name=value into properties, with the same validation as setProperty, and getCommandLineOptionsgetCommandLineOptionsgetCommandLineOptionsgetCommandLineOptionsgetCommandLineOptionsgetCommandLineOptionsgetCommandLineOptions converts a property set back into such arguments.
parse loads properties from the contents of a configuration file that you supply as a string.