Skip to content

Commit

Permalink
Introduce api module with io.smallrye.config.api.Config interface
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Sep 19, 2023
1 parent e06b7b7 commit 205696f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
21 changes: 21 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-parent</artifactId>
<version>3.3.4-SNAPSHOT</version>
</parent>

<artifactId>smallrye-config-api</artifactId>
<name>SmallRye Config: API</name>

<dependencies>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
</dependency>
</dependencies>
</project>
6 changes: 6 additions & 0 deletions api/src/main/java/io/smallrye/config/api/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.smallrye.config.api;

import java.io.Serializable;

public interface Config extends org.eclipse.microprofile.config.Config, Serializable {
}
4 changes: 2 additions & 2 deletions implementation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

<dependencies>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
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;
import org.eclipse.microprofile.config.spi.Converter;

import io.smallrye.common.annotation.Experimental;
import io.smallrye.config.SmallRyeConfigBuilder.InterceptorWithPriority;
import io.smallrye.config.api.Config;

/**
* @author <a href="http://jmesnil.net/">Jeff Mesnil</a> (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";
Expand Down Expand Up @@ -222,7 +222,8 @@ public <K, V> Map<K, V> getValuesAsMap(String name, Converter<K> keyConverter, C

/**
*
* This method handles calls from both {@link Config#getValue} and {@link Config#getOptionalValue}.<br>
* This method handles calls from both {@link org.eclipse.microprofile.config.Config#getValue} and
* {@link org.eclipse.microprofile.config.Config#getOptionalValue}.<br>
*/
@SuppressWarnings("unchecked")
public <T> T getValue(String name, Converter<T> converter) {
Expand Down Expand Up @@ -524,7 +525,7 @@ <T> Converter<T> getConverterOrNull(Class<T> asType) {

@Override
public <T> T unwrap(final Class<T> type) {
if (Config.class.isAssignableFrom(type)) {
if (org.eclipse.microprofile.config.Config.class.isAssignableFrom(type)) {
return type.cast(this);
}

Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
</scm>

<modules>
<module>api</module>
<module>common</module>
<module>implementation</module>
<module>cdi</module>
Expand Down Expand Up @@ -125,6 +126,11 @@
<artifactId>smallrye-config-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
Expand Down

0 comments on commit 205696f

Please sign in to comment.