Skip to content

Commit 5470f61

Browse files
committed
refactor: simplify constructors chaining
1 parent abca1aa commit 5470f61

File tree

1 file changed

+4
-12
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator

1 file changed

+4
-12
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/Operator.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ public Operator() {
3131
}
3232

3333
public Operator(KubernetesClient kubernetesClient) {
34-
this(kubernetesClient, ConfigurationServiceProvider.instance(), null);
34+
this(kubernetesClient, ConfigurationServiceProvider.instance());
3535
}
3636

3737
/**
3838
* @deprecated Use {@link #Operator(Consumer)} instead
3939
*/
40-
@Deprecated
40+
@Deprecated(forRemoval = true)
4141
public Operator(ConfigurationService configurationService) {
42-
this(null, configurationService, null);
42+
this(null, configurationService);
4343
}
4444

4545
public Operator(Consumer<ConfigurationServiceOverrider> overrider) {
4646
this(null, overrider);
4747
}
4848

4949
public Operator(KubernetesClient client, Consumer<ConfigurationServiceOverrider> overrider) {
50-
this(client, ConfigurationServiceProvider.instance(), overrider);
50+
this(client, ConfigurationServiceProvider.overrideCurrent(overrider));
5151
}
5252

5353
/**
@@ -58,17 +58,9 @@ public Operator(KubernetesClient client, Consumer<ConfigurationServiceOverrider>
5858
* @param configurationService provides configuration
5959
*/
6060
public Operator(KubernetesClient kubernetesClient, ConfigurationService configurationService) {
61-
this(kubernetesClient, configurationService, null);
62-
}
63-
64-
private Operator(KubernetesClient kubernetesClient, ConfigurationService configurationService,
65-
Consumer<ConfigurationServiceOverrider> overrider) {
6661
this.kubernetesClient =
6762
kubernetesClient != null ? kubernetesClient : new KubernetesClientBuilder().build();
6863
ConfigurationServiceProvider.set(configurationService);
69-
if (overrider != null) {
70-
ConfigurationServiceProvider.overrideCurrent(overrider);
71-
}
7264
ConfigurationServiceProvider.instance().getLeaderElectionConfiguration()
7365
.ifPresent(c -> leaderElectionManager.init(c, this.kubernetesClient));
7466
}

0 commit comments

Comments
 (0)