Skip to content

Commit 087f412

Browse files
committed
Polishing and fix typo
1 parent ed09a32 commit 087f412

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+115
-203
lines changed

src/main/java/io/asyncer/r2dbc/mysql/Capability.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ public boolean isProtocol41() {
216216
}
217217

218218
/**
219-
* Checks if can use var-integer sized bytes to encode client authentication.
219+
* Checks if allow to use var-integer sized bytes to encode client authentication.
220220
*
221-
* @return if can use var-integer sized authentication.
221+
* @return if allow to use var-integer sized authentication.
222222
*/
223223
public boolean isVarIntSizedAuthAllowed() {
224224
return (bitmap & VAR_INT_SIZED_AUTH) != 0;
@@ -236,7 +236,7 @@ public boolean isPluginAuthAllowed() {
236236
/**
237237
* Checks if the connection contains connection attributes.
238238
*
239-
* @return if has connection attributes.
239+
* @return if connection attributes exists.
240240
*/
241241
public boolean isConnectionAttributesAllowed() {
242242
return (bitmap & CONNECT_ATTRS) != 0;

src/main/java/io/asyncer/r2dbc/mysql/ColumnDefinition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public boolean isNotNull() {
7979
/**
8080
* Checks if value is an unsigned number. e.g. INT UNSIGNED, BIGINT UNSIGNED.
8181
* <p>
82-
* Note: IEEE-754 floating types (e.g. DOUBLE/FLOAT) do not supports it in MySQL 8.0+. When creating a
82+
* Note: IEEE-754 floating types (e.g. DOUBLE/FLOAT) do not support it in MySQL 8.0+. When creating a
8383
* column as an unsigned floating type, the server may report a warning.
8484
*
8585
* @return if value is an unsigned number.

src/main/java/io/asyncer/r2dbc/mysql/ConnectionContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
/**
3131
* The MySQL connection context considers the behavior of server or client.
3232
* <p>
33-
* WARNING: Do NOT change any data outside of this project, try configure {@code ConnectionFactoryOptions} or
34-
* {@code MySqlConnectionConfiguration} to control connection context and client behavior.
33+
* WARNING: Do NOT change any data outside of this project, try to configure {@code ConnectionFactoryOptions}
34+
* or {@code MySqlConnectionConfiguration} to control connection context and client behavior.
3535
*/
3636
public final class ConnectionContext implements CodecContext {
3737

src/main/java/io/asyncer/r2dbc/mysql/MySqlConnection.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -618,17 +618,13 @@ private static ZoneId convertZoneId(String id) {
618618
try {
619619
switch (realId) {
620620
case "Factory":
621-
// Looks like the "Factory" time zone is UTC.
621+
// It seems like UTC.
622622
return ZoneOffset.UTC;
623623
case "America/Nuuk":
624-
// They are same timezone including DST.
624+
// America/Godthab is the same as America/Nuuk, with DST.
625625
return ZoneId.of("America/Godthab");
626626
case "ROC":
627-
// Republic of China, 1912-1949, very very old time zone.
628-
// Even the ZoneId.SHORT_IDS does not support it.
629-
// Is there anyone using this time zone, really?
630-
// Don't think so, but should support it for compatible.
631-
// Just use GMT+8, id is equal to +08:00.
627+
// It is equal to +08:00.
632628
return ZoneId.of("+8");
633629
}
634630

src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionConfiguration.java

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import static io.asyncer.r2dbc.mysql.internal.util.InternalArrays.EMPTY_STRINGS;
4949

5050
/**
51-
* MySQL configuration of connection.
51+
* A configuration of MySQL connection.
5252
*/
5353
public final class MySqlConnectionConfiguration {
5454

@@ -461,7 +461,7 @@ public MySqlConnectionConfiguration build() {
461461
}
462462

463463
/**
464-
* Configure the database. Default no database.
464+
* Configures the database. Default no database.
465465
*
466466
* @param database the database, or {@code null} if no database want to be login.
467467
* @return this {@link Builder}.
@@ -473,7 +473,7 @@ public Builder database(@Nullable String database) {
473473
}
474474

475475
/**
476-
* Configure to create the database given in the configuration if it does not yet exist. Default to
476+
* Configures to create the database given in the configuration if it does not yet exist. Default to
477477
* {@code false}.
478478
*
479479
* @param enabled to discover and register extensions.
@@ -486,7 +486,7 @@ public Builder createDatabaseIfNotExist(boolean enabled) {
486486
}
487487

488488
/**
489-
* Configure the Unix Domain Socket to connect to.
489+
* Configures the Unix Domain Socket to connect to.
490490
*
491491
* @param unixSocket the socket file path.
492492
* @return this {@link Builder}.
@@ -500,7 +500,7 @@ public Builder unixSocket(String unixSocket) {
500500
}
501501

502502
/**
503-
* Configure the host.
503+
* Configures the host.
504504
*
505505
* @param host the host.
506506
* @return this {@link Builder}.
@@ -514,7 +514,7 @@ public Builder host(String host) {
514514
}
515515

516516
/**
517-
* Configure the password, MySQL allows to login without password.
517+
* Configures the password. Default login without password.
518518
* <p>
519519
* Note: for memory security, should not use intern {@link String} for password.
520520
*
@@ -528,7 +528,7 @@ public Builder password(@Nullable CharSequence password) {
528528
}
529529

530530
/**
531-
* Configure the port. Defaults to {@code 3306}.
531+
* Configures the port. Defaults to {@code 3306}.
532532
*
533533
* @param port the port.
534534
* @return this {@link Builder}.
@@ -543,9 +543,9 @@ public Builder port(int port) {
543543
}
544544

545545
/**
546-
* Configure the connection timeout. Default no timeout.
546+
* Configures the connection timeout. Default no timeout.
547547
*
548-
* @param connectTimeout the connection timeout, or {@code null} if has no timeout.
548+
* @param connectTimeout the connection timeout, or {@code null} if no timeout.
549549
* @return this {@link Builder}.
550550
* @since 0.8.1
551551
*/
@@ -555,7 +555,7 @@ public Builder connectTimeout(@Nullable Duration connectTimeout) {
555555
}
556556

557557
/**
558-
* Set the user for login the database.
558+
* Configures the user for login the database.
559559
*
560560
* @param user the user.
561561
* @return this {@link Builder}.
@@ -580,8 +580,7 @@ public Builder username(String user) {
580580
}
581581

582582
/**
583-
* Enforce the time zone of server. Default to query server time zone in initialization (no
584-
* enforce).
583+
* Configures the time zone of server. Default to query server time zone in initialization.
585584
*
586585
* @param serverZoneId the {@link ZoneId}, or {@code null} if query in initialization.
587586
* @return this {@link Builder}.
@@ -593,8 +592,8 @@ public Builder serverZoneId(@Nullable ZoneId serverZoneId) {
593592
}
594593

595594
/**
596-
* Configure the {@link ZeroDateOption}. It is a behavior option when this driver receives a value of
597-
* zero-date.
595+
* Configures the {@link ZeroDateOption}. Default to {@link ZeroDateOption#USE_NULL}. It is a
596+
* behavior option when this driver receives a value of zero-date.
598597
*
599598
* @param zeroDate the {@link ZeroDateOption}.
600599
* @return this {@link Builder}.
@@ -607,7 +606,7 @@ public Builder zeroDateOption(ZeroDateOption zeroDate) {
607606
}
608607

609608
/**
610-
* Configure ssl mode. See also {@link SslMode}.
609+
* Configures ssl mode. See also {@link SslMode}.
611610
*
612611
* @param sslMode the SSL mode to use.
613612
* @return this {@link Builder}.
@@ -620,7 +619,7 @@ public Builder sslMode(SslMode sslMode) {
620619
}
621620

622621
/**
623-
* Configure TLS versions, see {@link io.asyncer.r2dbc.mysql.constant.TlsVersions}.
622+
* Configures TLS versions, see {@link io.asyncer.r2dbc.mysql.constant.TlsVersions TlsVersions}.
624623
*
625624
* @param tlsVersion TLS versions.
626625
* @return this {@link Builder}.
@@ -643,7 +642,7 @@ public Builder tlsVersion(String... tlsVersion) {
643642
}
644643

645644
/**
646-
* Configure SSL {@link HostnameVerifier}, it is available only set {@link #sslMode(SslMode)} as
645+
* Configures SSL {@link HostnameVerifier}, it is available only set {@link #sslMode(SslMode)} as
647646
* {@link SslMode#VERIFY_IDENTITY}. It is useful when server was using special Certificates or need
648647
* special verification.
649648
* <p>
@@ -661,7 +660,7 @@ public Builder sslHostnameVerifier(HostnameVerifier sslHostnameVerifier) {
661660
}
662661

663662
/**
664-
* Configure SSL root certification for server certificate validation. It is only available if the
663+
* Configures SSL root certification for server certificate validation. It is only available if the
665664
* {@link #sslMode(SslMode)} is configured for verify server certification.
666665
* <p>
667666
* Default is {@code null}, which means that the default algorithm is used for the trust manager.
@@ -676,7 +675,7 @@ public Builder sslCa(@Nullable String sslCa) {
676675
}
677676

678677
/**
679-
* Configure client SSL certificate for client authentication.
678+
* Configures client SSL certificate for client authentication.
680679
* <p>
681680
* The {@link #sslCert} and {@link #sslKey} must be both non-{@code null} or both {@code null}.
682681
*
@@ -690,7 +689,7 @@ public Builder sslCert(@Nullable String sslCert) {
690689
}
691690

692691
/**
693-
* Configure client SSL key for client authentication.
692+
* Configures client SSL key for client authentication.
694693
* <p>
695694
* The {@link #sslCert} and {@link #sslKey} must be both non-{@code null} or both {@code null}.
696695
*
@@ -704,7 +703,7 @@ public Builder sslKey(@Nullable String sslKey) {
704703
}
705704

706705
/**
707-
* Configure the password of SSL key file for client certificate authentication.
706+
* Configures the password of SSL key file for client certificate authentication.
708707
* <p>
709708
* It will be used only if {@link #sslKey} and {@link #sslCert} non-null.
710709
*
@@ -719,7 +718,7 @@ public Builder sslKeyPassword(@Nullable CharSequence sslKeyPassword) {
719718
}
720719

721720
/**
722-
* Configure a {@link SslContextBuilder} customizer. The customizer gets applied on each SSL
721+
* Configures a {@link SslContextBuilder} customizer. The customizer gets applied on each SSL
723722
* connection attempt to allow for just-in-time configuration updates. The {@link Function} gets
724723
* called with the prepared {@link SslContextBuilder} that has all configuration options applied. The
725724
* customizer may return the same builder or return a new builder instance to be used to build the SSL
@@ -739,7 +738,7 @@ public Builder sslContextBuilderCustomizer(
739738
}
740739

741740
/**
742-
* Configure TCP KeepAlive.
741+
* Configures TCP KeepAlive.
743742
*
744743
* @param enabled whether to enable TCP KeepAlive
745744
* @return this {@link Builder}
@@ -752,7 +751,7 @@ public Builder tcpKeepAlive(boolean enabled) {
752751
}
753752

754753
/**
755-
* Configure TCP NoDelay.
754+
* Configures TCP NoDelay.
756755
*
757756
* @param enabled whether to enable TCP NoDelay
758757
* @return this {@link Builder}
@@ -765,7 +764,7 @@ public Builder tcpNoDelay(boolean enabled) {
765764
}
766765

767766
/**
768-
* Configure the protocol of parametrized statements to the text protocol.
767+
* Configures the protocol of parametrized statements to the text protocol.
769768
* <p>
770769
* The text protocol is default protocol that's using client-preparing. See also MySQL
771770
* documentations.
@@ -779,7 +778,7 @@ public Builder useClientPrepareStatement() {
779778
}
780779

781780
/**
782-
* Configure the protocol of parametrized statements to the binary protocol.
781+
* Configures the protocol of parametrized statements to the binary protocol.
783782
* <p>
784783
* The binary protocol is compact protocol that's using server-preparing. See also MySQL
785784
* documentations.
@@ -792,7 +791,7 @@ public Builder useServerPrepareStatement() {
792791
}
793792

794793
/**
795-
* Configure the protocol of parametrized statements and prepare-preferred simple statements to the
794+
* Configures the protocol of parametrized statements and prepare-preferred simple statements to the
796795
* binary protocol.
797796
* <p>
798797
* The {@code preferPrepareStatement} configures whether to prefer prepare execution on a
@@ -816,7 +815,7 @@ public Builder useServerPrepareStatement(Predicate<String> preferPrepareStatemen
816815
}
817816

818817
/**
819-
* Configure the session variables, used to set session variables immediately after login. Default no
818+
* Configures the session variables, used to set session variables immediately after login. Default no
820819
* session variables to set. It should be a list of key-value pairs. e.g.
821820
* {@code ["sql_mode='ANSI_QUOTES,STRICT_TRANS_TABLES'", "time_zone=00:00"]}.
822821
*

src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private static Mono<MySqlConnection> getMySqlConnection(
158158
})
159159
.flatMap(client -> {
160160
ByteBufAllocator allocator = client.getByteBufAllocator();
161-
CodecsBuilder builder = Codecs.builder(allocator);
161+
CodecsBuilder builder = Codecs.builder();
162162
PrepareCache prepareCache = Caches.createPrepareCache(prepareCacheSize);
163163
String db = createDbIfNotExist ? database : "";
164164

src/main/java/io/asyncer/r2dbc/mysql/MySqlNames.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ private static int binarySearch(String[] names, String name, boolean ignoreCase)
6767
left = middle + 1;
6868

6969
if (compared == -2) {
70-
// Match succeed if case insensitive, always use last
70+
// Match succeed if case-insensitive, always use last
7171
// matched result that will be closer to `name`.
7272
ciResult = middle;
7373
}
7474
} else if (compared > 0) {
7575
right = middle - 1;
7676

7777
if (compared == 2) {
78-
// Match succeed if case insensitive, always use last
78+
// Match succeed if case-insensitive, always use last
7979
// matched result that will be closer to `name`.
8080
ciResult = middle;
8181
}
8282
} else {
83-
// Match succeed when case sensitive, just return.
83+
// Match succeed when case-sensitive.
8484
return middle;
8585
}
8686
}
@@ -90,9 +90,9 @@ private static int binarySearch(String[] names, String name, boolean ignoreCase)
9090

9191
/**
9292
* Compares double strings and return an integer of both difference. If the integer is {@code 0} means
93-
* both strings equals even case sensitive, absolute value is {@code 2} means it is equals by case
94-
* insensitive but not equals when case sensitive, absolute value is {@code 4} means it is not equals even
95-
* case insensitive.
93+
* both strings equals even case-sensitive, absolute value is {@code 2} means it is equals by
94+
* case-insensitive but not equals when case-sensitive, absolute value is {@code 4} means it is not equals
95+
* even case-insensitive.
9696
* <p>
9797
* Note: visible for unit tests.
9898
*
@@ -117,7 +117,7 @@ private static int compare0(String left, String right, int start, int end) {
117117

118118
if (leftCh != rightCh) {
119119
if (csCompared == 0) {
120-
// Compare end if is case sensitive comparator.
120+
// Compare end if is case-sensitive comparator.
121121
csCompared = leftCh - rightCh;
122122
}
123123

@@ -126,18 +126,18 @@ private static int compare0(String left, String right, int start, int end) {
126126
rightCh = Character.toLowerCase(rightCh);
127127

128128
if (leftCh != rightCh) {
129-
// Not equals even case insensitive.
129+
// Not equals even case-insensitive.
130130
return leftCh < rightCh ? -4 : 4;
131131
}
132132
}
133133
}
134134

135-
// Length not equals means both strings not equals even case insensitive.
135+
// Length not equals means both strings not equals even case-insensitive.
136136
if (leftSize != rightSize) {
137137
return leftSize < rightSize ? -4 : 4;
138138
}
139139

140-
// Equals when case insensitive, use case sensitive.
140+
// Equals when case-insensitive, use case-sensitive.
141141
return csCompared < 0 ? -2 : (csCompared > 0 ? 2 : 0);
142142
}
143143

src/main/java/io/asyncer/r2dbc/mysql/MySqlParameter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ default boolean isNull() {
4343
* Binary protocol encoding. See MySQL protocol documentations, if don't want to support the binary
4444
* protocol, please receive an exception.
4545
* <p>
46-
* Note: not like the text protocol, it make a sense for state-less.
46+
* Note: not like the text protocol, it makes a sense for state-less.
4747
* <p>
4848
* Binary protocol maybe need to add a var-integer length before encoded content. So if makes it like
4949
* {@code Mono<Void> publishBinary (Xxx binaryWriter)}, and if supports multiple times writing like a
@@ -75,9 +75,9 @@ default boolean isNull() {
7575
Mono<Void> publishText(ParameterWriter writer);
7676

7777
/**
78-
* Get the {@link MySqlType} of this parameter data.
78+
* Gets the {@link MySqlType} of this parameter data.
7979
* <p>
80-
* If don't want to support the binary protocol, just throw an exception please.
80+
* If it does not want to support the binary protocol, just throw an exception please.
8181
*
8282
* @return the MySQL type.
8383
*/

src/main/java/io/asyncer/r2dbc/mysql/MySqlSslConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import static io.asyncer.r2dbc.mysql.internal.util.InternalArrays.EMPTY_STRINGS;
3030

3131
/**
32-
* MySQL configuration of SSL.
32+
* A configuration of MySQL SSL connection.
3333
*/
3434
public final class MySqlSslConfiguration {
3535

0 commit comments

Comments
 (0)