forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add and integrate build-time config source build item
Part of quarkusio#3008
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
.../src/main/java/io/quarkus/deployment/builditem/BuildTimeConfigurationSourceBuildItem.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,43 @@ | ||
package io.quarkus.deployment.builditem; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import org.eclipse.microprofile.config.spi.ConfigSource; | ||
import org.wildfly.common.Assert; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
/** | ||
* Define an additional configuration source which is used at build time. | ||
*/ | ||
public final class BuildTimeConfigurationSourceBuildItem extends MultiBuildItem { | ||
private final Supplier<ConfigSource> configSourceSupplier; | ||
|
||
/** | ||
* Construct a new instance. | ||
* | ||
* @param configSourceSupplier the config source supplier (must not be {@code null}) | ||
*/ | ||
public BuildTimeConfigurationSourceBuildItem(final Supplier<ConfigSource> configSourceSupplier) { | ||
Assert.checkNotNullParam("configSourceSupplier", configSourceSupplier); | ||
this.configSourceSupplier = configSourceSupplier; | ||
} | ||
|
||
/** | ||
* Construct a new instance. | ||
* | ||
* @param configSource the config source (must not be {@code null}) | ||
*/ | ||
public BuildTimeConfigurationSourceBuildItem(final ConfigSource configSource) { | ||
this(() -> Assert.checkNotNullParam("configSource", configSource)); | ||
} | ||
|
||
/** | ||
* Get the config source supplier. | ||
* | ||
* @return the config source supplier | ||
*/ | ||
public Supplier<ConfigSource> getConfigSourceSupplier() { | ||
return configSourceSupplier; | ||
} | ||
} |
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