com.github.phillipkruger.microprofileextentions.config.MemoryConfigSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of config-ext Show documentation
Show all versions of config-ext Show documentation
Some default config providers and converters
package com.github.phillipkruger.microprofileextentions.config;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.java.Log;
import org.eclipse.microprofile.config.spi.ConfigSource;
/**
* In memory config
* @author Phillip Kruger ([email protected])
*/
@Log
public class MemoryConfigSource implements ConfigSource {
public static final String NAME = "MemoryConfigSource";
private static final Map PROPERTIES = new HashMap<>();
public MemoryConfigSource(){
log.info("Loading [memory] MicroProfile ConfigSource");
}
@Override
public int getOrdinal() {
return 900;
}
@Override
public Map getProperties() {
return PROPERTIES;
}
@Override
public String getValue(String key) {
if(PROPERTIES.containsKey(key)){
return PROPERTIES.get(key);
}
return null;
}
@Override
public String getName() {
return NAME;
}
}