Description
The ConnectionUtils class provides a set of utility functions used to process connection parameters.
Static methods
composeUri
Composes URI from config parameters. The result URI will be in the following form: protocol://username@password@host1:port1,host2:port2,…?param1=abc¶m2=xyz&…
public static
String composeUri(ConfigParams options, String defaultProtocol, int defaultPort)
- options: ConfigParams - configuration parameters
- defaultProtocol: String - a default protocol
- defaultPort: int - a default port
- returns: string - a composed URI
concat
Concatinates two options by combining duplicated properties into comma-separated list
public static
concat(options1: ConfigParams, options2: ConfigParams, …keys: string): ConfigParams
- options1: ConfigParams - first options to merge
- options2: ConfigParams - second options to merge
- keys: string - when defined, it limits only to specific keys
- returns: ConfigParams - new connection parameters to be added
exclude
Excludes specified keys from the config parameters.
public static
ConfigParams concat(ConfigParams options1, ConfigParams options2, Listkeys)
- options: ConfigParams - configuration parameters to be processed.
- keys: List
- a list of keys to be excluded. - returns: ConfigParams - a processed config parameters.
include
Includes specified keys from the config parameters.
public static
ConfigParams include(ConfigParams options, Listkeys)
- options: ConfigParams - configuration parameters to be processed.
- keys: List
- a list of keys to be included. - returns: ConfigParams - a processed config parameters.
parseUri
Parses URI into config parameters.
The URI shall be in the following form:
protocol://username@password@host1:port1,host2:port2,...?param1=abc¶m2=xyz&...
public static
ConfigParams parseUri(String uri, String defaultProtocol, int defaultPort)
- uri: String - the URI to be parsed
- defaultProtocol: String - a default protocol
- defaultPort: int - a default port
- returns: ConfigParams - a configuration parameters with URI elements
rename
Renames property if the target name is not used.
public static
ConfigParams rename(ConfigParams options, String fromName, String toName)
- options: ConfigParams - configuration options
- fromName: String - original property name.
- toName: String - property name to rename to.
- returns: ConfigParams - updated configuration options