ConnectionFactorys.
A ConnectionFactoryOptions represents a configuration state that consists of one or more Option objects. Each configuration option can be specified at most once to associate a
value with its key.
New objects are constructed through builder() or by parsing a R2DBC Connection URL.
ConnectionFactoryOptions can be augmented to allow staged construction of the configuration state using a initialized builder to create a new ConnectionFactoryOptions objects with mutations applied. Values of this class are immutable once created. Builder initializers are left unchanged.
Example usage:
ConnectionFactoryOptions options = ConnectionFactoryOptions.builder()
.option(ConnectionFactoryOptions.DRIVER, "a-driver")
.option(ConnectionFactoryOptions.PROTOCOL, "pipes")
.option(ConnectionFactoryOptions.HOST, "localhost")
.option(ConnectionFactoryOptions.PORT, 3306)
.option(ConnectionFactoryOptions.DATABASE, "my_database")
.option(Option.valueOf("locale"), "en_US")
.build();
Note that Connection URL Parsing cannot access Option type information T due to Java's type erasure. Options configured by URL parsing are represented as String values.
ConnectionFactories
| Modifier and Type | Class and Description |
|---|---|
| public static class | ConnectionFactoryOptions.Builder
A builder for |
| Modifier and Type | Field and Description |
|---|---|
| public static final Option | CONNECT_TIMEOUT
Connection timeout. |
| public static final Option | DATABASE
Initial database name. |
| public static final Option | DRIVER
Driver name. |
| public static final Option | HOST
Endpoint host name. |
| public static final Option | LOCK_WAIT_TIMEOUT
Lock timeout. |
| private final Map | |
| public static final Option | PASSWORD
Password for authentication. |
| public static final Option | PORT
Endpoint port number. |
| public static final Option | PROTOCOL
Driver protocol name. |
| public static final Option | SSL
Whether to require SSL. |
| public static final Option | STATEMENT_TIMEOUT
Statement timeout. |
| public static final Option | USER
User for authentication. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ConnectionFactoryOptions. | |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public Object | Returns: the value for an optionthe option to retrieve the value for option)Returns the value for an option if it exists. |
| public Object | |
| public int | |
| public boolean | |
| public ConnectionFactoryOptions. | |
| public static ConnectionFactoryOptions | Returns: the parsedConnectionFactoryOptions.the R2DBC URL. url)Parses a R2DBC Connection URL and returns the parsed |
| public String | |
| private static String |
| CONNECT_TIMEOUT | back to summary |
|---|---|
| public static final Option<Duration> CONNECT_TIMEOUT Connection timeout. | |
| DATABASE | back to summary |
|---|---|
| public static final Option<String> DATABASE Initial database name. | |
| DRIVER | back to summary |
|---|---|
| public static final Option<String> DRIVER Driver name. | |
| HOST | back to summary |
|---|---|
| public static final Option<String> HOST Endpoint host name. | |
| LOCK_WAIT_TIMEOUT | back to summary |
|---|---|
| public static final Option<Duration> LOCK_WAIT_TIMEOUT Lock timeout.
| |
| options | back to summary |
|---|---|
| private final Map<Option<?>, Object> options | |
| PASSWORD | back to summary |
|---|---|
| public static final Option<CharSequence> PASSWORD Password for authentication. | |
| PORT | back to summary |
|---|---|
| public static final Option<Integer> PORT Endpoint port number. | |
| PROTOCOL | back to summary |
|---|---|
| public static final Option<String> PROTOCOL Driver protocol name. Typically represented as | |
| SSL | back to summary |
|---|---|
| public static final Option<Boolean> SSL Whether to require SSL. | |
| STATEMENT_TIMEOUT | back to summary |
|---|---|
| public static final Option<Duration> STATEMENT_TIMEOUT Statement timeout.
| |
| USER | back to summary |
|---|---|
| public static final Option<String> USER User for authentication. | |
| ConnectionFactoryOptions | back to summary |
|---|---|
| private ConnectionFactoryOptions(Map<Option<?>, Object> options) | |
| builder | back to summary |
|---|---|
| public static ConnectionFactoryOptions. Returns a new
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getRequiredValue | back to summary |
|---|---|
| public Object getRequiredValue(Option<?> option) Returns the value for an option if it exists.
| |
| getValue | back to summary |
|---|---|
| public Object getValue(Option<?> option) Returns the value for an option if it exists, otherwise
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| hasOption | back to summary |
|---|---|
| public boolean hasOption(Option<?> option) Returns
| |
| mutate | back to summary |
|---|---|
| public ConnectionFactoryOptions. Returns a new
| |
| parse | back to summary |
|---|---|
| public static ConnectionFactoryOptions parse(CharSequence url) Parses a R2DBC Connection URL and returns the parsed
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| toString | back to summary |
|---|---|
| private static String toString(Map<Option<?>, Object> options) | |
ConnectionFactoryOptions instances.
This class is not threadsafe
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ConnectionFactoryOptions | |
| public ConnectionFactoryOptions. | Returns: thisBuildera configured connectionFactoryOptions)ConnectionFactoryOptionsPopulates the builder with the existing values from a configured |
| public ConnectionFactoryOptions. | Returns: thisBuildera configured connectionFactoryOptions, Predicate<Option<?>> ConnectionFactoryOptionsa filter)filter function to include/exclude existing Options.Populates the builder with the existing values from a configured |
| public < the type of the value T> ConnectionFactoryOptions. | |
| public String |
| options | back to summary |
|---|---|
| private final Map<Option<?>, Object> options | |
| Builder | back to summary |
|---|---|
| private Builder() | |
| build | back to summary |
|---|---|
| public ConnectionFactoryOptions build() Returns a configured
| |
| from | back to summary |
|---|---|
| public ConnectionFactoryOptions. Populates the builder with the existing values from a configured
| |
| from | back to summary |
|---|---|
| public ConnectionFactoryOptions. Populates the builder with the existing values from a configured
| |
| option | back to summary |
|---|---|
| public <T> ConnectionFactoryOptions. Configure an
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |