Search in sources :

Example 1 with SystemProperty

use of com.oracle.bedrock.runtime.java.options.SystemProperty in project oracle-bedrock by coherence-community.

the class Ports method asMappedProperties.

/**
 * Obtain a {@link SystemProperties} instance that is a copy of the specified
 * {@link SystemProperties} with all of the properties contained within this
 * {@link Ports} altered to be the value of the mapped ports.
 *
 * @param properties  the {@link SystemProperties} to copy
 *
 * @return  a {@link SystemProperties} with the mapped port values
 */
public SystemProperties asMappedProperties(SystemProperties properties) {
    SystemProperties copy = new SystemProperties(properties);
    Map<String, Object> mappedProperties = new HashMap<>();
    for (SystemProperty property : properties) {
        String name = property.getName();
        if (ports.containsKey(name)) {
            Port port = ports.get(name);
            mappedProperties.put(name, port.getMappedPort());
        }
    }
    return copy.addAll(mappedProperties);
}
Also used : SystemProperties(com.oracle.bedrock.runtime.java.options.SystemProperties) HashMap(java.util.HashMap) SystemProperty(com.oracle.bedrock.runtime.java.options.SystemProperty)

Aggregations

SystemProperties (com.oracle.bedrock.runtime.java.options.SystemProperties)1 SystemProperty (com.oracle.bedrock.runtime.java.options.SystemProperty)1 HashMap (java.util.HashMap)1