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

io.quarkus.dev.console.TempSystemProperties Maven / Gradle / Ivy

There is a newer version: 3.17.0
Show newest version
package io.quarkus.dev.console;

import java.util.HashMap;
import java.util.Map;

/**
 * TODO: this is a hack, we should be able to pass config overrides into the bootstrap
 */
public class TempSystemProperties implements AutoCloseable {
    final Map old = new HashMap<>();

    public void set(String key, String value) {
        old.put(key, System.getProperty(key));
        System.setProperty(key, value);
    }

    @Override
    public void close() {
        for (Map.Entry e : old.entrySet()) {
            if (e.getValue() == null) {
                System.clearProperty(e.getKey());
            } else {
                System.setProperty(e.getKey(), e.getValue());
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy