Skip to content

Commit 5645003

Browse files
committed
Polishing
Rearrange methods and properties by name. [#296]
1 parent 233f16e commit 5645003

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/main/java/io/r2dbc/postgresql/PostgresqlConnectionConfiguration.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public final class PostgresqlConnectionConfiguration {
7777

7878
private final int port;
7979

80+
private final int preparedStatementCacheQueries;
81+
8082
private final String socket;
8183

8284
private final String username;
@@ -87,12 +89,10 @@ public final class PostgresqlConnectionConfiguration {
8789

8890
private final boolean tcpNoDelay;
8991

90-
private final int preparedStatementCacheQueries;
91-
9292
private PostgresqlConnectionConfiguration(String applicationName, boolean autodetectExtensions, @Nullable Duration connectTimeout, @Nullable String database, List<Extension> extensions,
9393
ToIntFunction<String> fetchSize, boolean forceBinary, @Nullable String host, @Nullable Map<String, String> options, @Nullable CharSequence password,
94-
int port, @Nullable String schema, @Nullable String socket, boolean tcpKeepAlive, boolean tcpNoDelay, String username, SSLConfig sslConfig,
95-
int preparedStatementCacheQueries) {
94+
int port, int preparedStatementCacheQueries, @Nullable String schema, @Nullable String socket, boolean tcpKeepAlive, boolean tcpNoDelay,
95+
String username, SSLConfig sslConfig) {
9696
this.applicationName = Assert.requireNonNull(applicationName, "applicationName must not be null");
9797
this.autodetectExtensions = autodetectExtensions;
9898
this.connectTimeout = connectTimeout;
@@ -109,12 +109,12 @@ private PostgresqlConnectionConfiguration(String applicationName, boolean autode
109109

110110
this.password = password;
111111
this.port = port;
112+
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
112113
this.socket = socket;
113114
this.username = Assert.requireNonNull(username, "username must not be null");
114115
this.sslConfig = sslConfig;
115116
this.tcpKeepAlive = tcpKeepAlive;
116117
this.tcpNoDelay = tcpNoDelay;
117-
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
118118
}
119119

120120
/**
@@ -201,6 +201,10 @@ int getPort() {
201201
return this.port;
202202
}
203203

204+
int getPreparedStatementCacheQueries() {
205+
return this.preparedStatementCacheQueries;
206+
}
207+
204208
@Nullable
205209
String getSocket() {
206210
return this.socket;
@@ -240,15 +244,10 @@ boolean isTcpNoDelay() {
240244
boolean isUseSocket() {
241245
return getSocket() != null;
242246
}
243-
244247
SSLConfig getSslConfig() {
245248
return this.sslConfig;
246249
}
247250

248-
int getPreparedStatementCacheQueries() {
249-
return this.preparedStatementCacheQueries;
250-
}
251-
252251
private static String obfuscate(int length) {
253252

254253
StringBuilder builder = new StringBuilder();
@@ -293,6 +292,8 @@ public static final class Builder {
293292

294293
private int port = DEFAULT_PORT;
295294

295+
private int preparedStatementCacheQueries = -1;
296+
296297
@Nullable
297298
private String schema;
298299

@@ -324,8 +325,6 @@ public static final class Builder {
324325
@Nullable
325326
private String username;
326327

327-
private int preparedStatementCacheQueries = -1;
328-
329328
private Builder() {
330329
}
331330

@@ -372,8 +371,9 @@ public PostgresqlConnectionConfiguration build() {
372371
}
373372

374373
return new PostgresqlConnectionConfiguration(this.applicationName, this.autodetectExtensions, this.connectTimeout, this.database, this.extensions, this.fetchSize, this.forceBinary,
375-
this.host, this.options, this.password, this.port, this.schema, this.socket, this.tcpKeepAlive, this.tcpNoDelay, this.username, this.createSslConfig(),
376-
this.preparedStatementCacheQueries);
374+
this.host, this.options, this.password, this.port, this.preparedStatementCacheQueries, this.schema, this.socket, this.tcpKeepAlive, this.tcpNoDelay, this.username,
375+
this.createSslConfig()
376+
);
377377
}
378378

379379
/**
@@ -525,6 +525,19 @@ public Builder port(int port) {
525525
return this;
526526
}
527527

528+
/**
529+
* Configure the preparedStatementCacheQueries. The default is {@code -1}, meaning there's no limit. The value of {@code 0} disables the cache. Any other value specifies the cache size.
530+
*
531+
* @param preparedStatementCacheQueries the preparedStatementCacheQueries
532+
* @return this {@link Builder}
533+
* @throws IllegalArgumentException if {@code username} is {@code null}
534+
* @since 0.8.1
535+
*/
536+
public Builder preparedStatementCacheQueries(int preparedStatementCacheQueries) {
537+
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
538+
return this;
539+
}
540+
528541
/**
529542
* Configure the schema.
530543
*
@@ -667,19 +680,6 @@ public Builder username(String username) {
667680
return this;
668681
}
669682

670-
/**
671-
* Configure the preparedStatementCacheQueries. The default is {@code -1}, meaning there's no limit. The value of {@code 0} disables the cache. Any other value specifies the cache size.
672-
*
673-
* @param preparedStatementCacheQueries the preparedStatementCacheQueries
674-
* @return this {@link Builder}
675-
* @throws IllegalArgumentException if {@code username} is {@code null}
676-
* @since 0.8.1
677-
*/
678-
public Builder preparedStatementCacheQueries(int preparedStatementCacheQueries) {
679-
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
680-
return this;
681-
}
682-
683683
@Override
684684
public String toString() {
685685
return "Builder{" +
@@ -694,8 +694,8 @@ public String toString() {
694694
", parameters='" + this.options + '\'' +
695695
", password='" + obfuscate(this.password != null ? this.password.length() : 0) + '\'' +
696696
", port=" + this.port +
697+
", preparedStatementCacheQueries='" + this.preparedStatementCacheQueries + '\'' +
697698
", schema='" + this.schema + '\'' +
698-
", username='" + this.username + '\'' +
699699
", socket='" + this.socket + '\'' +
700700
", sslContextBuilderCustomizer='" + this.sslContextBuilderCustomizer + '\'' +
701701
", sslMode='" + this.sslMode + '\'' +
@@ -705,7 +705,7 @@ public String toString() {
705705
", sslHostnameVerifier='" + this.sslHostnameVerifier + '\'' +
706706
", tcpKeepAlive='" + this.tcpKeepAlive + '\'' +
707707
", tcpNoDelay='" + this.tcpNoDelay + '\'' +
708-
", preparedStatementCacheQueries='" + this.preparedStatementCacheQueries + '\'' +
708+
", username='" + this.username + '\'' +
709709
'}';
710710
}
711711

0 commit comments

Comments
 (0)