Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2014-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import groovy.util.ConfigObject;
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.convert.ConversionException;
import org.springframework.core.convert.support.ConfigurableConversionService;
import org.springframework.core.convert.support.DefaultConversionService;
import grails.config.Config;
import grails.util.GrailsStringUtils;
import org.grails.core.exceptions.GrailsConfigurationException;
/**
* A {@link Config} implementation that operates against a {@link org.grails.config.NavigableMap}
*
* This class behavior is related to {@link org.grails.config.NavigableMap} which will be removed in future.
* Use {@link grails.config.Config} instead.
* @author Graeme Rocher
* @since 3.0
*/
public abstract class NavigableMapConfig implements Config {
protected static final Logger logger = LoggerFactory.getLogger(NavigableMapConfig.class);
protected ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
protected ConfigurableConversionService conversionService = new DefaultConversionService();
protected NavigableMap configMap = new NavigableMap() {
@Override
protected Object mergeMapEntry(NavigableMap targetMap, String sourceKey, Object newValue) {
if (newValue instanceof CharSequence) {
newValue = resolvePlaceholders(newValue.toString());
}
return super.mergeMapEntry(targetMap, sourceKey, newValue);
}
};
@Override
public int hashCode() {
return this.configMap.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NavigableMapConfig) {
return this.configMap.equals(((NavigableMapConfig) obj).configMap);
}
return false;
}
@Override
public String toString() {
return this.configMap.toString();
}
@Override
public Object getAt(Object key) {
return get(key);
}
@Override
public void setAt(Object key, Object value) {
this.configMap.put(key.toString(), value);
}
@Override
public int size() {
return this.configMap.size();
}
@Override
public boolean isEmpty() {
return this.configMap.isEmpty();
}
@Override
public boolean containsKey(Object key) {
return containsProperty(key.toString());
}
@Override
public boolean containsValue(Object value) {
return this.configMap.containsValue(value);
}
@Override
public Object get(Object key) {
return this.configMap.getProperty(key.toString());
}
@Override
public Object put(String key, Object value) {
return this.configMap.put(key, value);
}
@Override
public Object remove(Object key) {
return this.configMap.remove(key);
}
@Override
public void putAll(Map extends String, ?> m) {
this.configMap.putAll(m);
}
@Override
public void clear() {
this.configMap.clear();
}
@Override
public Set keySet() {
return this.configMap.keySet();
}
@Override
public Collection