sk.antons.jaul.util.TransitiveProperties Maven / Gradle / Ivy
/*
* Copyright 2015 Anton Straka
*
* 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
*
* http://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 sk.antons.jaul.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import sk.antons.jaul.Replace;
/**
* Helper class for making java Properties transitive. You can use use ${prop name}
* in property values. This placeholdes will be replaced to property name.
*
* property1=value1
* property2=value2 ${property1}
*
* Then property2 will have value 'value2 value1'
*
* Implementation expects that all keys and values are strings.
*
* @author antons
*/
public class TransitiveProperties {
/**
* Replace ${} place holders in provided properties. It is useful for
* properties, which is not modified any more. So after properties
* initialization just call this method to fulfill transitive values.
* @param props properties to be modified for transitive values
*/
public static void makeClosure(Properties props) {
if(props == null) return;
for(Map.Entry © 2015 - 2025 Weber Informatics LLC | Privacy Policy