32 * default values by the {@code ConnectionBuilder}.
33 * <p>The following example illustrates the use of {@code ConnectionBuilder}
34 * to create a {@link Connection}:
35 *
36 * <pre>{@code
37 * DataSource ds = new MyDataSource();
38 * ShardingKey superShardingKey = ds.createShardingKeyBuilder()
39 * .subkey("EASTERN_REGION", JDBCType.VARCHAR)
40 * .build();
41 * ShardingKey shardingKey = ds.createShardingKeyBuilder()
42 * .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
43 * .build();
44 * Connection con = ds.createConnectionBuilder()
45 * .user("rafa")
46 * .password("tennis")
47 * .setShardingKey(shardingKey)
48 * .setSuperShardingKey(superShardingKey)
49 * .build();
50 * }</pre>
51 *
52 * @since 1.9
53 *
54 */
55 public interface ConnectionBuilder {
56
57 /**
58 * Specifies the username to be used when creating a connection
59 *
60 * @param username the database user on whose behalf the connection is being
61 * made
62 * @return the same {@code ConnectionBuilder} instance
63 */
64 ConnectionBuilder user(String username);
65
66 /**
67 * Specifies the password to be used when creating a connection
68 *
69 * @param password the password to use for this connection. May be {@code null}
70 * @return the same {@code ConnectionBuilder} instance
71 */
72 ConnectionBuilder password(String password);
|
32 * default values by the {@code ConnectionBuilder}.
33 * <p>The following example illustrates the use of {@code ConnectionBuilder}
34 * to create a {@link Connection}:
35 *
36 * <pre>{@code
37 * DataSource ds = new MyDataSource();
38 * ShardingKey superShardingKey = ds.createShardingKeyBuilder()
39 * .subkey("EASTERN_REGION", JDBCType.VARCHAR)
40 * .build();
41 * ShardingKey shardingKey = ds.createShardingKeyBuilder()
42 * .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR)
43 * .build();
44 * Connection con = ds.createConnectionBuilder()
45 * .user("rafa")
46 * .password("tennis")
47 * .setShardingKey(shardingKey)
48 * .setSuperShardingKey(superShardingKey)
49 * .build();
50 * }</pre>
51 *
52 * @since 9
53 *
54 */
55 public interface ConnectionBuilder {
56
57 /**
58 * Specifies the username to be used when creating a connection
59 *
60 * @param username the database user on whose behalf the connection is being
61 * made
62 * @return the same {@code ConnectionBuilder} instance
63 */
64 ConnectionBuilder user(String username);
65
66 /**
67 * Specifies the password to be used when creating a connection
68 *
69 * @param password the password to use for this connection. May be {@code null}
70 * @return the same {@code ConnectionBuilder} instance
71 */
72 ConnectionBuilder password(String password);
|