Skip to content

Commit b508c36

Browse files
committed
Polishing
Rearrange methods and properties by name. [#296]
1 parent b78ed91 commit b508c36

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

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

+31-31
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public final class PostgresqlConnectionConfiguration {
8585

8686
private final int port;
8787

88+
private final int preparedStatementCacheQueries;
89+
8890
private final String socket;
8991

9092
private final String username;
@@ -95,15 +97,13 @@ public final class PostgresqlConnectionConfiguration {
9597

9698
private final boolean tcpNoDelay;
9799

98-
private final int preparedStatementCacheQueries;
99-
100100
private PostgresqlConnectionConfiguration(String applicationName, boolean autodetectExtensions, @Nullable Duration connectTimeout, @Nullable String database, LogLevel errorResponseLogLevel,
101101
List<Extension> extensions,
102102
ToIntFunction<String> fetchSize, boolean forceBinary,
103103
LogLevel noticeLogLevel, @Nullable String host,
104-
@Nullable Map<String, String> options, @Nullable CharSequence password, int port, @Nullable String schema,
105-
@Nullable String socket, boolean tcpKeepAlive, boolean tcpNoDelay, String username, SSLConfig sslConfig,
106-
int preparedStatementCacheQueries) {
104+
@Nullable Map<String, String> options, @Nullable CharSequence password, int port, int preparedStatementCacheQueries, @Nullable String schema,
105+
@Nullable String socket, boolean tcpKeepAlive, boolean tcpNoDelay,
106+
String username, SSLConfig sslConfig) {
107107
this.applicationName = Assert.requireNonNull(applicationName, "applicationName must not be null");
108108
this.autodetectExtensions = autodetectExtensions;
109109
this.connectTimeout = connectTimeout;
@@ -122,12 +122,12 @@ private PostgresqlConnectionConfiguration(String applicationName, boolean autode
122122

123123
this.password = password;
124124
this.port = port;
125+
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
125126
this.socket = socket;
126127
this.username = Assert.requireNonNull(username, "username must not be null");
127128
this.sslConfig = sslConfig;
128129
this.tcpKeepAlive = tcpKeepAlive;
129130
this.tcpNoDelay = tcpNoDelay;
130-
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
131131
}
132132

133133
/**
@@ -216,6 +216,10 @@ int getPort() {
216216
return this.port;
217217
}
218218

219+
int getPreparedStatementCacheQueries() {
220+
return this.preparedStatementCacheQueries;
221+
}
222+
219223
@Nullable
220224
String getSocket() {
221225
return this.socket;
@@ -255,7 +259,6 @@ boolean isTcpNoDelay() {
255259
boolean isUseSocket() {
256260
return getSocket() != null;
257261
}
258-
259262
SSLConfig getSslConfig() {
260263
return this.sslConfig;
261264
}
@@ -271,10 +274,6 @@ ConnectionSettings getConnectionSettings() {
271274
.build();
272275
}
273276

274-
int getPreparedStatementCacheQueries() {
275-
return this.preparedStatementCacheQueries;
276-
}
277-
278277
private static String obfuscate(int length) {
279278

280279
StringBuilder builder = new StringBuilder();
@@ -323,6 +322,8 @@ public static final class Builder {
323322

324323
private int port = DEFAULT_PORT;
325324

325+
private int preparedStatementCacheQueries = -1;
326+
326327
@Nullable
327328
private String schema;
328329

@@ -354,8 +355,6 @@ public static final class Builder {
354355
@Nullable
355356
private String username;
356357

357-
private int preparedStatementCacheQueries = -1;
358-
359358
private Builder() {
360359
}
361360

@@ -402,9 +401,10 @@ public PostgresqlConnectionConfiguration build() {
402401
}
403402

404403
return new PostgresqlConnectionConfiguration(this.applicationName, this.autodetectExtensions, this.connectTimeout, this.database, this.errorResponseLogLevel, this.extensions,
405-
this.fetchSize, this.forceBinary, this.noticeLogLevel, this.host, this.options, this.password, this.port, this.schema, this.socket, this.tcpKeepAlive, this.tcpNoDelay, this.username
406-
, this.createSslConfig(),
407-
this.preparedStatementCacheQueries);
404+
this.fetchSize, this.forceBinary, this.noticeLogLevel, this.host, this.options, this.password, this.port, this.preparedStatementCacheQueries, this.schema, this.socket, this.tcpKeepAlive, this.tcpNoDelay, this.username
405+
,
406+
this.createSslConfig()
407+
);
408408
}
409409

410410
/**
@@ -580,6 +580,19 @@ public Builder port(int port) {
580580
return this;
581581
}
582582

583+
/**
584+
* 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.
585+
*
586+
* @param preparedStatementCacheQueries the preparedStatementCacheQueries
587+
* @return this {@link Builder}
588+
* @throws IllegalArgumentException if {@code username} is {@code null}
589+
* @since 0.8.1
590+
*/
591+
public Builder preparedStatementCacheQueries(int preparedStatementCacheQueries) {
592+
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
593+
return this;
594+
}
595+
583596
/**
584597
* Configure the schema.
585598
*
@@ -722,19 +735,6 @@ public Builder username(String username) {
722735
return this;
723736
}
724737

725-
/**
726-
* 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.
727-
*
728-
* @param preparedStatementCacheQueries the preparedStatementCacheQueries
729-
* @return this {@link Builder}
730-
* @throws IllegalArgumentException if {@code username} is {@code null}
731-
* @since 0.8.1
732-
*/
733-
public Builder preparedStatementCacheQueries(int preparedStatementCacheQueries) {
734-
this.preparedStatementCacheQueries = preparedStatementCacheQueries;
735-
return this;
736-
}
737-
738738
@Override
739739
public String toString() {
740740
return "Builder{" +
@@ -751,8 +751,8 @@ public String toString() {
751751
", parameters='" + this.options + '\'' +
752752
", password='" + obfuscate(this.password != null ? this.password.length() : 0) + '\'' +
753753
", port=" + this.port +
754+
", preparedStatementCacheQueries='" + this.preparedStatementCacheQueries + '\'' +
754755
", schema='" + this.schema + '\'' +
755-
", username='" + this.username + '\'' +
756756
", socket='" + this.socket + '\'' +
757757
", sslContextBuilderCustomizer='" + this.sslContextBuilderCustomizer + '\'' +
758758
", sslMode='" + this.sslMode + '\'' +
@@ -762,7 +762,7 @@ public String toString() {
762762
", sslHostnameVerifier='" + this.sslHostnameVerifier + '\'' +
763763
", tcpKeepAlive='" + this.tcpKeepAlive + '\'' +
764764
", tcpNoDelay='" + this.tcpNoDelay + '\'' +
765-
", preparedStatementCacheQueries='" + this.preparedStatementCacheQueries + '\'' +
765+
", username='" + this.username + '\'' +
766766
'}';
767767
}
768768

0 commit comments

Comments
 (0)