-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arc - introduce ArcInitConfig object along with a builder, replace ex…
…isting usages, deprecate former init method
- Loading branch information
Showing
4 changed files
with
84 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcInitConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package io.quarkus.arc; | ||
|
||
/** | ||
* A configuration object used while initializing Arc, see {@link Arc#initialize()} methods. | ||
* Consolidates all configuration objects needed for Arc to initialize, values are initialized to their defaults. | ||
* | ||
*/ | ||
public final class ArcInitConfig { | ||
|
||
/** | ||
* Basic instance without any configuration, all values are default | ||
*/ | ||
public static final ArcInitConfig INSTANCE = builder().build(); | ||
|
||
/** | ||
* Obtains a builder for {@link ArcInitConfig} | ||
* | ||
* @return new instance of the builder | ||
*/ | ||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
private ArcInitConfig(Builder builder) { | ||
this.currentContextFactory = builder.currentContextFactory; | ||
this.strictCompatibility = builder.strictCompatibility; | ||
} | ||
|
||
private final boolean strictCompatibility; | ||
private final CurrentContextFactory currentContextFactory; | ||
|
||
public boolean isStrictCompatibility() { | ||
return strictCompatibility; | ||
} | ||
|
||
public CurrentContextFactory getCurrentContextFactory() { | ||
return currentContextFactory; | ||
} | ||
|
||
public static class Builder { | ||
private boolean strictCompatibility; | ||
private CurrentContextFactory currentContextFactory; | ||
|
||
private Builder() { | ||
// init all values with their defaults | ||
this.strictCompatibility = false; | ||
this.currentContextFactory = null; | ||
} | ||
|
||
public Builder setStrictCompatibility(boolean strictCompatibility) { | ||
this.strictCompatibility = strictCompatibility; | ||
return this; | ||
} | ||
|
||
public Builder setCurrentContextFactory(CurrentContextFactory currentContextFactory) { | ||
this.currentContextFactory = currentContextFactory; | ||
return this; | ||
} | ||
|
||
public ArcInitConfig build() { | ||
return new ArcInitConfig(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters