All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.phillipkruger.microprofileextentions.config.MemoryConfigSource Maven / Gradle / Ivy

There is a newer version: 1.0.8
Show newest version
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;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy