Skip to content

Commit 6ea05be

Browse files
author
Brian Chen
authored
fix: make BulkWriterOptions public (#502)
1 parent 0e6f3da commit 6ea05be

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

google-cloud-firestore/src/main/java/com/google/cloud/firestore/BulkWriterOptions.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,27 @@
1919
import com.google.api.core.BetaApi;
2020
import com.google.auto.value.AutoValue;
2121
import java.util.concurrent.ScheduledExecutorService;
22+
import javax.annotation.Nonnull;
2223
import javax.annotation.Nullable;
2324

2425
/** Options used to configure request throttling in BulkWriter. */
2526
@BetaApi
2627
@AutoValue
27-
abstract class BulkWriterOptions {
28+
public abstract class BulkWriterOptions {
2829
/**
2930
* Return whether throttling is enabled.
3031
*
3132
* @return Whether throttling is enabled.
3233
*/
33-
abstract boolean getThrottlingEnabled();
34+
public abstract boolean getThrottlingEnabled();
3435

3536
/**
3637
* Returns the initial maximum number of operations per second allowed by the throttler.
3738
*
3839
* @return The initial maximum number of operations per second allowed by the throttler.
3940
*/
4041
@Nullable
41-
abstract Double getInitialOpsPerSecond();
42+
public abstract Double getInitialOpsPerSecond();
4243

4344
/**
4445
* Returns the maximum number of operations per second allowed by the throttler.
@@ -49,33 +50,33 @@ abstract class BulkWriterOptions {
4950
* @return The maximum number of operations per second allowed by the throttler.
5051
*/
5152
@Nullable
52-
abstract Double getMaxOpsPerSecond();
53+
public abstract Double getMaxOpsPerSecond();
5354

5455
/**
5556
* @return The {@link ScheduledExecutorService} that BulkWriter uses to schedule all operations.
5657
* If null, the default executor will be used.
5758
*/
5859
@Nullable
59-
abstract ScheduledExecutorService getExecutor();
60+
public abstract ScheduledExecutorService getExecutor();
6061

61-
static Builder builder() {
62+
public static Builder builder() {
6263
return new AutoValue_BulkWriterOptions.Builder()
6364
.setMaxOpsPerSecond(null)
6465
.setInitialOpsPerSecond(null)
6566
.setThrottlingEnabled(true)
6667
.setExecutor(null);
6768
}
6869

69-
abstract Builder toBuilder();
70+
public abstract Builder toBuilder();
7071

7172
@AutoValue.Builder
72-
abstract static class Builder {
73+
public abstract static class Builder {
7374
/**
7475
* Sets whether throttling should be enabled. By default, throttling is enabled.
7576
*
7677
* @param enabled Whether throttling should be enabled.
7778
*/
78-
abstract Builder setThrottlingEnabled(boolean enabled);
79+
public abstract Builder setThrottlingEnabled(boolean enabled);
7980

8081
/**
8182
* Set the initial maximum number of operations per second allowed by the throttler.
@@ -91,7 +92,7 @@ abstract static class Builder {
9192
* @param initialOpsPerSecond The initial maximum number of operations per second allowed by the
9293
* throttler.
9394
*/
94-
Builder setInitialOpsPerSecond(int initialOpsPerSecond) {
95+
public Builder setInitialOpsPerSecond(int initialOpsPerSecond) {
9596
return setInitialOpsPerSecond(new Double(initialOpsPerSecond));
9697
}
9798

@@ -111,7 +112,7 @@ Builder setInitialOpsPerSecond(int initialOpsPerSecond) {
111112
* The throttler's allowed operations per second does not ramp up past the specified
112113
* operations per second.
113114
*/
114-
Builder setMaxOpsPerSecond(int maxOpsPerSecond) {
115+
public Builder setMaxOpsPerSecond(int maxOpsPerSecond) {
115116
return setMaxOpsPerSecond(new Double(maxOpsPerSecond));
116117
}
117118

@@ -120,11 +121,12 @@ Builder setMaxOpsPerSecond(int maxOpsPerSecond) {
120121
*
121122
* @param executor The executor to schedule BulkWriter operations on.
122123
*/
123-
abstract Builder setExecutor(@Nullable ScheduledExecutorService executor);
124+
public abstract Builder setExecutor(@Nullable ScheduledExecutorService executor);
124125

125-
abstract BulkWriterOptions autoBuild();
126+
public abstract BulkWriterOptions autoBuild();
126127

127-
BulkWriterOptions build() {
128+
@Nonnull
129+
public BulkWriterOptions build() {
128130
BulkWriterOptions options = autoBuild();
129131
Double initialRate = options.getInitialOpsPerSecond();
130132
Double maxRate = options.getMaxOpsPerSecond();

0 commit comments

Comments
 (0)