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

org.grails.config.FlatConfig Maven / Gradle / Ivy

There is a newer version: 6.2.0
Show newest version
package org.grails.config;

import grails.config.Config;
import groovy.util.ConfigObject;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * @author Graeme Rocher
 * @since 3.0.10
 *
 * @deprecated Here for backwards compatibility, do not use directly
 */
@Deprecated
public class FlatConfig implements Map  {

    private final Config config;

    public FlatConfig(Config config) {
        this.config = config;
    }

    @Override
    public int size() {
        return config.size();
    }

    @Override
    public boolean isEmpty() {
        return config.isEmpty();
    }

    @Override
    public boolean containsKey(Object key) {
        return config.containsKey(key);
    }

    @Override
    public boolean containsValue(Object value) {
        return config.containsValue(value);
    }

    @Override
    public Object get(Object key) {
        Object o = config.get(key);
        if(o instanceof NavigableMap.NullSafeNavigator) {
            return null;
        }
        else if(o instanceof ConfigObject) {
            return null;
        }
        return o;
    }

    @Override
    public Object put(String key, Object value) {
        return config.put(key, value);
    }

    @Override
    public Object remove(Object key) {
        return config.remove(key);
    }

    @Override
    public void putAll(Map m) {
        config.putAll(m);
    }

    @Override
    public void clear() {
        config.clear();
    }

    @Override
    public Set keySet() {
        return config.keySet();
    }

    @Override
    public Collection values() {
        return config.values();
    }

    @Override
    public Set> entrySet() {
        return config.entrySet();
    }
}