From 205696f20ab3f8d515a7de0cbae952eb53adadfe Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Tue, 19 Sep 2023 09:19:47 -0300 Subject: [PATCH] Introduce `api` module with `io.smallrye.config.api.Config` interface --- api/pom.xml | 21 +++++++++++++++++++ .../java/io/smallrye/config/api/Config.java | 6 ++++++ implementation/pom.xml | 4 ++-- .../io/smallrye/config/SmallRyeConfig.java | 9 ++++---- pom.xml | 6 ++++++ 5 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 api/pom.xml create mode 100644 api/src/main/java/io/smallrye/config/api/Config.java diff --git a/api/pom.xml b/api/pom.xml new file mode 100644 index 000000000..a36cba770 --- /dev/null +++ b/api/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + io.smallrye.config + smallrye-config-parent + 3.3.4-SNAPSHOT + + + smallrye-config-api + SmallRye Config: API + + + + org.eclipse.microprofile.config + microprofile-config-api + + + diff --git a/api/src/main/java/io/smallrye/config/api/Config.java b/api/src/main/java/io/smallrye/config/api/Config.java new file mode 100644 index 000000000..ed26d011c --- /dev/null +++ b/api/src/main/java/io/smallrye/config/api/Config.java @@ -0,0 +1,6 @@ +package io.smallrye.config.api; + +import java.io.Serializable; + +public interface Config extends org.eclipse.microprofile.config.Config, Serializable { +} diff --git a/implementation/pom.xml b/implementation/pom.xml index c8b2e6ec8..8f204da12 100644 --- a/implementation/pom.xml +++ b/implementation/pom.xml @@ -29,8 +29,8 @@ - org.eclipse.microprofile.config - microprofile-config-api + io.smallrye.config + smallrye-config-api jakarta.annotation diff --git a/implementation/src/main/java/io/smallrye/config/SmallRyeConfig.java b/implementation/src/main/java/io/smallrye/config/SmallRyeConfig.java index 1376fc189..424029847 100644 --- a/implementation/src/main/java/io/smallrye/config/SmallRyeConfig.java +++ b/implementation/src/main/java/io/smallrye/config/SmallRyeConfig.java @@ -37,7 +37,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.IntFunction; -import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.config.spi.ConfigSource; import org.eclipse.microprofile.config.spi.ConfigSourceProvider; @@ -45,11 +44,12 @@ import io.smallrye.common.annotation.Experimental; import io.smallrye.config.SmallRyeConfigBuilder.InterceptorWithPriority; +import io.smallrye.config.api.Config; /** * @author Jeff Mesnil (c) 2017 Red Hat inc. */ -public class SmallRyeConfig implements Config, Serializable { +public class SmallRyeConfig implements Config { public static final String SMALLRYE_CONFIG_PROFILE = "smallrye.config.profile"; public static final String SMALLRYE_CONFIG_PROFILE_PARENT = "smallrye.config.profile.parent"; public static final String SMALLRYE_CONFIG_LOCATIONS = "smallrye.config.locations"; @@ -222,7 +222,8 @@ public Map getValuesAsMap(String name, Converter keyConverter, C /** * - * This method handles calls from both {@link Config#getValue} and {@link Config#getOptionalValue}.
+ * This method handles calls from both {@link org.eclipse.microprofile.config.Config#getValue} and + * {@link org.eclipse.microprofile.config.Config#getOptionalValue}.
*/ @SuppressWarnings("unchecked") public T getValue(String name, Converter converter) { @@ -524,7 +525,7 @@ Converter getConverterOrNull(Class asType) { @Override public T unwrap(final Class type) { - if (Config.class.isAssignableFrom(type)) { + if (org.eclipse.microprofile.config.Config.class.isAssignableFrom(type)) { return type.cast(this); } diff --git a/pom.xml b/pom.xml index 16cc747c5..4a2c52c25 100644 --- a/pom.xml +++ b/pom.xml @@ -64,6 +64,7 @@ + api common implementation cdi @@ -125,6 +126,11 @@ smallrye-config-core ${project.version}
+ + io.smallrye.config + smallrye-config-api + ${project.version} + io.smallrye.config smallrye-config