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

com.github.mthizo247.cloud.netflix.zuul.web.util.MapPropertyResolver Maven / Gradle / Ivy

package com.github.mthizo247.cloud.netflix.zuul.web.util;

import org.springframework.core.env.AbstractPropertyResolver;

import java.util.Map;

/**
 * @author Ronald Mthombeni
 */
public class MapPropertyResolver extends AbstractPropertyResolver {

    private Map map;

    public MapPropertyResolver(Map map) {
        this.map = map;
    }

    @Override
    protected String getPropertyAsRawString(String key) {
        Object v = map.get(key);
        return v != null ? v.toString() : null;
    }

    @Override
    public  T getProperty(String key, Class targetType) {
        Object v = map.get(key);
        if (v != null) {
            return targetType.cast(v);
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy