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&…
static
String composeUri(ConfigParams options, String? defaultProtocol, int? defaultPort)
- options: ConfigParams - configuration parameters
- defaultProtocol: String? - default protocol
- defaultPort: int? - default port
- returns: String - composed URI
concat
Concatinates two options by combining duplicated properties into a comma-separated list
static
ConfigParams concat(ConfigParams options1, ConfigParams options2, [List<String> keys])
- options1: ConfigParams - first options to merge
- options2: ConfigParams - second options to merge
- keys: List<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.
static
ConfigParams exclude(ConfigParams options, List<String>? keys)
- options: ConfigParams - configuration parameters to be processed.
- keys: List<String>? - ist of keys to be excluded.
- returns: ConfigParams - processed config parameters.
include
Includes specified keys from the config parameters.
static
ConfigParams include(ConfigParams options, List<String>? keys)
- options: ConfigParams - configuration parameters to be processed.
- keys: List<String>? - list of keys to be included.
- returns: ConfigParams - processed config parameters.
rename
Renames property if the target name is not used.
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
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&...
static
ConfigParams parseUri(String? uri, String defaultProtocol, String defaultPort)
- uri: String? - URI to be parsed
- defaultProtocol: String - default protocol
- defaultPort: String - default port
- returns: ConfigParams - configuration parameters with URI elements