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

io.quarkus.cli.common.PropertiesOptions Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package io.quarkus.cli.common;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import picocli.CommandLine;

public class PropertiesOptions {
    public Map properties = new HashMap<>();

    @CommandLine.Option(names = "-D", mapFallbackValue = "", description = "Java properties")
    void setProperty(Map props) {
        this.properties = props;
    }

    public void flattenJvmArgs(List jvmArgs, Collection args) {
        String jvmArgProperty = properties.remove("jvm.args");
        if (jvmArgProperty != null && !jvmArgProperty.isBlank()) {
            jvmArgs.add(jvmArgProperty);
        }

        if (!jvmArgs.isEmpty()) {
            args.add("-Djvm.args='" + String.join(" ", jvmArgs) + "'");
        }
    }

    @Override
    public String toString() {
        return properties.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy