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

com.netflix.archaius.interpolate.ConfigStrLookup Maven / Gradle / Ivy

There is a newer version: 2.8.2
Show newest version
package com.netflix.archaius.interpolate;

import com.netflix.archaius.api.Config;
import com.netflix.archaius.api.StrInterpolator.Lookup;

/**
 * Interpolator lookup using a Config as the source
 * @author elandau
 *
 */
public class ConfigStrLookup implements Lookup {

    private Config config;

    public ConfigStrLookup(Config config) {
        this.config = config;
    }
    
    @Override
    public String lookup(String key) {
        Object value = config.getRawProperty(key);
        if (value == null) {
            return null;
        }
        return value.toString();
    }

    public static Lookup from(Config config) {
        return new ConfigStrLookup(config);
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy