Java Properties mergeSystemProperties(Properties properties)

Here you can find the source of mergeSystemProperties(Properties properties)

Description

Add properties to the system properties.

License

Open Source License

Parameter

Parameter Description
properties Contains the properties to add to the list of system properties

Declaration


public static void mergeSystemProperties(Properties properties) 

Method Source Code

//package com.java2s;
/*//  ww w  . j  av  a2 s  . c o  m
 * @(#)PropertyUtility.java
 *
 * Copyright 2003 by EkoLiving Pty Ltd.  All Rights Reserved.
 *
 * This software is the proprietary information of EkoLiving Pty Ltd.
 * Use is subject to license terms.
 */

import java.util.*;

public class Main {
    /**
     * Add properties to the system properties. Note that existing
     * system properties <u>WILL NOT</u> be overwritten by this method.
     *  
     * @param properties Contains the properties to add to the list of system properties
     */

    public static void mergeSystemProperties(Properties properties) {
        if (properties == null)
            return;

        Enumeration enumeration = properties.propertyNames();
        while (enumeration.hasMoreElements()) {
            String name = (String) enumeration.nextElement();
            if (System.getProperty(name) == null) {
                String value = properties.getProperty(name);
                System.setProperty(name, value);
            }
        }
    }
}

Related

  1. isKeySame(String key, Properties p1, Properties p2)
  2. isSupportedJVM(Map jdkProperties)
  3. maskApplicationEnvProperties(Map environmentVariables, Set variablesToMask)
  4. mergePropertiesIntoMap(Properties props, Map map)
  5. mergePropertiesIntoMap(Properties props, Map map)
  6. propertiesToJson(Properties properties)
  7. propertiesToMap(Properties props)
  8. putAll(final Map props, final Properties p)
  9. putAll(Properties properties, Map result)